GUI Programming

Started by
11 comments, last by Teknofreek 18 years, 8 months ago
Hi, I'm just wondering if anyone knows any good tutorials/books/code/anything on making a good gui in win32 c++? I basically want to incorporate graphics into my app in pretty much everything (buttons, backgrounds, menus, etc, like some apps do), so that it looks great and nothing like a windows app. Thanks for any help. --likeregularchickens.
Advertisement
Do you want a custom GUI or are you looking to use the standard windows GUI items?

If you desire a custom GUI, this is the best tutorial I have come across so far. GUIs lend themselves well to inheritance so programming one would be a good lesson in C++ too.

Now if you want to use the standard windows widgets, then look into .NET or MFC. Depending on your needs, you may or may not want to require the .NET framework to be installed on a client's machine.
....[size="1"]Brent Gunning
If you use SDL you can take a look at the list of GUI libraries

SDL - libraries

If you are interested there is also this demo

NVidia Natural Demo by Abzerati (a 'javacool' dude of this forum).
The demo is for OpenGL but the GUI is quite virtual and OS/API independent; i found the directory GUI a real treasure!!! Grab it!!!
Start to focalize with the idea of events and messages passed hierarchical (via virtual functions)...

edited: added ref to the demo
I suggest QT from Trolltech, it rocks.
Quote:Original post by blizzard999
If you use SDL you can take a look at the list of GUI libraries

SDL - libraries

If you are interested there is also this demo

NVidia Natural Demo by Abzerati (a 'javacool' dude of this forum).
The demo is for OpenGL but the GUI is quite virtual and OS/API independent; i found the directory GUI a real treasure!!! Grab it!!!
Start to focalize with the idea of events and messages passed hierarchical (via virtual functions)...

edited: added ref to the demo


i havent looked too closely at the code but you said its OS independent? i develop OpenGL stuff in windows but need to port it over to Linux so i am using GLUT and it would be nice if i could easily use this GUI with GLUT that i have. i wasnt sure if the latest update(as seen in that demo) is really Cross platform?? could someone verify this? btw i only have VC 6 at work which is why i am unable to view it.
heh
Quote:Original post by OpenGL_Guru
i havent looked too closely at the code but you said its OS independent? i develop OpenGL stuff in windows but need to port it over to Linux so i am using GLUT and it would be nice if i could easily use this GUI with GLUT that i have. i wasnt sure if the latest update(as seen in that demo) is really Cross platform?? could someone verify this? btw i only have VC 6 at work which is why i am unable to view it.


Do you need VC>6 to read some code? I use the PSPad when I want read something...:)

Strictly It's not cross platform! It's based on window&GL but...java cool dude knows the matter. The GUI code is really clean and it does not depend from Windows so much. Obviously you have to reimplement the 'message pump' (you use GLUT) but it is worthwhile to take a look at the code logic behind the implementation.
He has implemented text box, buttons, combo box, check box,...!!! Great! And this is only the 'marginal' part of the demo!
However do not expect a plug&play API! :)
There's a lot to consider when designing a UI. How it's going to look/function can be decided/confused by a lot of factors.

You can skin the window; you can subclass and draw your own controls; you can use what's given you; you can use different widget sets/libraries.

This has got to be the most difficult issue in application programming (UI), unless you plan on hard-coding all your UI data.

How do you set the initial size of your window? Do you hardcode the data? If you don't hardcode the data, how do you decide where to place each of the widgets? How do you decide what happens to the widgets when the window is resized?

What about more difficult issues, like docking subwindows? If your child windows are dockable, what "rule" governs where the window will dock? How is that "rule" expressed?

If GUI element placement/size is governed by "rules", how are these "rules" expressed?

I've seen implementations of this using XML; unfortunately, not very many that aren't extremely convoluted.

There's a nice series in C/C++ Users Journal on UI, beginning either in May or June of this year... going either each month, or every other month.

---

It would really be nice to get

1) A nice example of someone creating a very clean UI interface with owner drawn widgets, using a rule-based size/position/resizing algorithm that is extensible and scaleable... a system that could be wrapped by any number of reader's C++ code.

2) A good non MFC/ATL/.NET example of user drawn, alpha-blended buttons in all four states (pressed/hovering/unpressed/disabled) ... something like Paul Nettle's example... but with Win32

3) A DRAWING tut that focuses on drawing custom widgets... alpha-blended, full color widgets

So far I'm cutting my own swath in each of these areas. Reinventing the wheel is tough [smile]
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
I agree! Implement a GUI is really an hard task also in the case you use high level graphics API. You should see it as a long term project!
Really, you must have a solid knowledge about virtual classes, messages, know how to generate a font, write it, drag a window instead of write in a text box...you must have at least a background as GUI 'user' ( ie: MFC in windows )
In other words: if this is an hobby, an interest, a work -> OK otherwise you can try one of the several open source GUI lib (OpenGL based).
If you plan to do it yourself, understand that the code sample proposed by Abzerati (correct?!) is the minimim you have to do!
Hi,

I need to be able to do this for my final year project at uni, so i cant use any libraries or anything. I want to figure out how to do it before I start it properly so i dont take too long on gui when it comes down to it. There's alot of stuff about advanced gui and creating skinned apps here http://www.codeproject.com/dialog/ so i think i should be able to get something going from that. I've had alot of experience with win32 gui and C++. I think it'll probably be best to read up on MFC first.

Thanks for your help.

--likeregularchickens
Quote:Original post by likeregularchickens
I need to be able to do this for my final year project at uni, so i cant use any libraries or anything.


If your project IS a OpenGL cross platform GUI ok otherwise I see nothing wrong in using an open source library (moreover you will put the source with the documentation/thesis so you will not violate any open source license).
You can focalize on the thesis related problems.

Quote:
I think it'll probably be best to read up on MFC first.


See also the java architecture (I think MFC are ugly&crappy)(my personal opinion of course :) )
But if I need to write rapidly a GUI interface under Win32 I use them...

This topic is closed to new replies.

Advertisement