test

I want to make a Graphical User Interface (need advice)

Page 1 of 1 [ 9 posts ] 

techn0teen
Veteran
Veteran

User avatar

Joined: 14 Sep 2010
Age:23
Posts: 663

23 May 2011, 5:45 pm

I have almost four months of summer vacation before I go back to the university. I decided to work on a long term project that I can put three hours of work in a day.

I want to make a free, simple software program that integrates video games and community service for my college and community. However, I am having trouble finding out how to make a graphical user interface (GUI).

I need the user to visually interact with the program (I cannot just ask them to interact on a terminal) since I want this for a general audience. Things like a window with buttons and text fields.

I heard GTK+ and QT were good things to use in developing a GUI, but I am not sure what I need to download to have it all working and running. Thanks!

(I have a Windows 7 OS if that helps. I also have Linux on another computer).



hadrian_f
Blue Jay
Blue Jay

User avatar

Joined: 18 May 2011
Posts: 91

23 May 2011, 6:07 pm

Well, both GTK+ and QT are available on both Linux and WinX, which makes cross-platform easier. GTK+ is originally written for C but has a C++ compatibility layer (gtkmm), it is rather easy to learn as there is plenty of documentation.

QT is I believe written for C++ and there should be just as much documentation.

Both are fine, I think QT is slightly more common, but personally I prefer GTK as it provides a better-looking UI. This is however my personal opinion and what I advice you to do is simply look up a few tutorials and make your own decision.

If you use GNOME on that linux box, GTK might be more interesting though ;)



computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age:114
Posts: 6,701

24 May 2011, 12:15 am

"integrate video games and community service"

Can you be more specific? That way any of the dorks in here will give a better advice.

HTML5 is hot right now, and will give an advantage in the future (with CSS and Photoshop or any other graphics software). And what you create you can get the whole world to see in a browser.

Lua is great too. If you're gonna learn to program, forget C++, jump directly to Lua. Lua is easy to learn and widely suportted.

Lua + Corona SDK (a framework for developing for iOS/Android, already has GUI elements, so you can focus on the goal and don't waste time.

Plus, what you learn can make you earn some $$ ;)

Good luck man.


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


Burzum
Veteran
Veteran

User avatar

Joined: 26 Apr 2011
Age:24
Posts: 1,205

24 May 2011, 1:58 am

If you have the time and want a challenge you can do it using direct calls to the Windows API.

Here's an example of how it works, though you would of course write a wrapper to make it easier. Then maybe write an XML parser or something so you can load the interface from a file.

Code:
#include <windows.h>

const int BUTTON1 = 1;
bool quit = false;

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
   if(msg == WM_DESTROY)
   {
      quit = true;
      return 0;
   }
   else if(msg == WM_CTLCOLORSTATIC)
   {
      SetBkMode((HDC)wparam, TRANSPARENT);
      return (long)CreateSolidBrush(0xFFFFFF);
      return 0;
   }
   else if(msg == WM_COMMAND && HIWORD(wparam) == BN_CLICKED && LOWORD(wparam) == BUTTON1)
   {
      MessageBox(hwnd, "Hello", "Hello", 0);
      return 0;
   }
   return DefWindowProc(hwnd, msg, wparam, lparam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
   WNDCLASS wc;
   ZeroMemory(&wc, sizeof(wc));
   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
   wc.hCursor = LoadCursor(0, IDC_ARROW);
   wc.hInstance = GetModuleHandle(0);
   wc.lpfnWndProc = WndProc;
   wc.lpszClassName = "lol";
   wc.style = CS_HREDRAW | CS_VREDRAW;
   RegisterClass(&wc);
   HWND mainwnd = CreateWindow("lol", "Hello", WS_SYSMENU,
      40, 40, 200, 150, 0, 0, GetModuleHandle(0), 0);
   HWND text = CreateWindow("STATIC", "Hello", WS_VISIBLE | WS_CHILD, 10, 10, 180, 20, mainwnd, 0, GetModuleHandle(0), 0);
   HWND editbox = CreateWindow("EDIT", "Hello", WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL | ES_UPPERCASE,
      10, 30, 100, 30, mainwnd, 0, GetModuleHandle(0), 0);
   HWND button = CreateWindow("BUTTON", "Hello", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 120, 30, 50, 30, mainwnd, (HMENU)BUTTON1, GetModuleHandle(0), 0);
   ShowWindow(mainwnd, SW_SHOW);
   while(!quit)
   {
      MSG msg;
      if(GetMessage(&msg, mainwnd, 0, 0))
      {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
      }
   }
   return 0;
}



Oh, and if you can put up with .NET then try .NET forms. You can use them with C++ using C++/CLI.



peterd
Veteran
Veteran

User avatar

Joined: 25 Dec 2006
Age:63
Posts: 1,275

24 May 2011, 6:34 am

Or, you could work out the HTML for the page as you'd like it to be seen, and write a simple XQuery that presents it. Pop the XQuery into an exist-db server and you're away. You're open source, free of licence fees and you can deliver to any web browser in the world.



computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age:114
Posts: 6,701

24 May 2011, 8:05 am

Burzum wrote:
If you have the time and want a challenge you can do it using direct calls to the Windows API.
Windows is soooo 1999, so passé


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


techn0teen
Veteran
Veteran

User avatar

Joined: 14 Sep 2010
Age:23
Posts: 663

24 May 2011, 3:48 pm

computerlove wrote:
"integrate video games and community service"

Can you be more specific? That way any of the dorks in here will give a better advice.


The idea is that pre-approved local businesses and organizations submit small tasks called "missions" to a local community. Volunteers can accomplish these tasks and earn points. There are levels that each have their "perks" once a volunteer obtains them. I want it to be available for my university (which recently obtained the President's award for community service).

Quote:
And what you create you can get the whole world to see in a browser.


Unfortunately, I do not have the money to host a website right now and pay for a domain name. I know this would be the easiest way, but I feel forced out of it.

Any ideas on how to do it online? (My University gives me some free space online for a student website, but I could possibly edit it for other purposes).

Quote:
Windows is soooo 1999, so passé


Windows still has a large market. If you want to reach the masses, one need to at least understand Window Products.



computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age:114
Posts: 6,701

24 May 2011, 10:00 pm

Nice idea, I'd love to see it develop!

What you're trying to do sounds like a great way to learn Ruby on Rails, check first you have if it's installed at your uni.

about the domain, at least try to get "gamename.universityname.edu".


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age:114
Posts: 6,701

25 May 2011, 12:04 am

Hell, just remembered this: if you don't want to complicate, there's already a Drupal profile
http://drupal.org/project/meetu

as you've seen, there are many routes


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.