Hello!
I need to know ,that how to create a graphical user interface in c++.
can somebody please tell me the way to do it, or if you have a code can
somebody please send it to the forum.
Remember however that not everything is Windows based.
Try some multi-platform libraries (such as SDL, openGL) so that in case you switch OS's, you won't have any problems recompiling or having to learn a new library.
Remember however that not everything is Windows based.
Try some multi-platform libraries (such as SDL, openGL) so that in case you switch OS's, you won't have any problems recompiling or having to learn a new library.
I am currently trying to get to used to Qt, it looks kind of useable. Someone on IRC said, though, that they were constantly working against it, due to the poor code it generates. Is that true (of course machine-generated code holds lot of space for optimisation, I should think, but does it geenrate code which is grossly inefficient, is my question), or is it rather a matter of taste?
Edit: Also, none of the above links work for me. The first gives me a 404 error, the latter an empty directory.
Edit 2: Thanks Aakanaar, not looking at the URL was my mistake :(
Dunno about the empty index (i'm getting that too) but for the first one
Click the link, get your 404 error, go up to address and erase the period at the end of the addres
Or right click and copy link, paste into address bar and erase the period at the end.
edit: Ok, found problem with second link. He meant wxwidgets.org not wxwindows.org
Edit 2: Ok.. So I like WxWidgets. It's free, open source, multi-platform, and from what I see, it's thin and doesn't have a lot of overhead. Anything to make creating and using a GUI is good for me.
On the other hand, i've always been warned to stay away from stuff that auto-generates code for you, as they are never optimised for speed, and have a lot of overhead (includes entire headers even if you only need one function). At least those warnings always came with why we should never use MFC.. so i've never used MFC.
Is this different? Is this better than MFC? Is the tradeoff of speed and size worth the savings of my sanity from the gui code problem? Will Batman save Commisioner Gordon from the Joker's evil and mischevious trap?
Qt is a very powerful, very complete package. It isn't just a GUI framework, it is an "application framework" --meaning it includes a lot of stuff besides just what you need to display pretty windows. I would be wary about listening to people on IRC complain about poor code generation when using a library --compilers generate code, not libraries. Perhaps he ought to get a better compiler? A good optimizing compiler will get rid of unused stuff (or "dead code").
The main thing about Qt is that it is a proprietary commercial product. Trolltech lets people use it for free to develop free stuff, but you must have a commercial license to use or develop with it commercially, and you can never mix the two.
GTK, WxWidgets, FLTK, and FOX are all much smaller libraries, designed mainly as GUI toolkits. They are all very good and popular. I suggest you look through their docs and examples and decide which you like best and/or which best suits your needs.
Sorry bout the link, it used to be called wxWindows :)
WxWidgets is similar to QT in that it also includes other components (networking, databases etc) that a normal GUI Toolkit doesn't include.
As for code generation, are they taking about dialog editors like the one provided by wxWidgets? I have always coded the UI myself manually (similar to Java's SWING/AWT)
well, I mentioned code generation, i think cause someone above said it. I think they mean that the code in the libraries arn't optimized.
Generally speaking, almost every win32 tutorial I've seen online have one main re-occuring statement, and that is to avoid MFC. Mainly cause the functions in MFC were generalized and not neccessarily specific to what you needed. As a result, they were bloated, and not optimised for speed, etc.
WxWidgets looks interesting (been reading the documentation section trying to decide if I should download) but I wonder if it's just another MFC in sheeps clothing.
It really comes down, i suppose, to which is more important to you as a programmer. The ease (well, easier anyway) of a library that is setup to handle Windows GUI (or cross platform GUI as in this case) or the headache of doing the GUI code yourself using windows.h. (which isn't cross platform)
I'll be reading that first link thoroughly, as in some cases, it may be better to just do it "The Hard Way".
Edit::
But while i'm on the topic.. I also know that a lot of windows programs can be done using dialogs which can be built in a resource file. I'm using DevC++ and it has no resource editor capable of generating dialogs.. so I'm kina looking for something that'll help me do that, as well as figgure out how to use those effectively.
If I were to use Qt under OSX to create a GUI for a program, how portable would that be, specifically to Windows XP? I'm guessing not very, but I'd be very happy to learn that I am wrong, since it would not require me to learn how to write GUI code for Win in C++ (currently reading the relisoft tutorials).