Question:
How do I program GUIs in C/C++?
neverrain89
2008-10-06 07:26:58 UTC
Excuse my ignorance, but since I have very little experience in C/C++ programming, I have a lot of questions that look difficult for me to answer.

Nowadays I'm not interested in other languages, and I want to get up to speed with the C language as time goes by. One of the biggest problems I encounter is my inability to know about GUI programming in C/C++.

I've heard that one can use widget toolkits like GTK+, Qt, wxWidgets, MFC, WTL etc. to develope GUIs for software applications written in the C programming language; however, I wonder whether I can write my own functions and classes to design my own GUIs, without taking advantage of the toolkits mentioned above.

Is that possible?
Four answers:
aryaxt
2008-10-06 07:51:43 UTC
Let me make ur lfe easier

get a Microsoft Visual C++

or Microsoft Visual Studi

and making gui will be as easy as dragging and dropping

don't waste ur time on GUI spend time on the logic and code



My suggestion about the language go with C#

Easier to learn, very powerfull, great IDE visual studio, and u can use it for app developement and also web developement (background language for asp.net)

alot of companies are switching from C++ to C#

specially game companies
no1home2day
2008-10-06 07:36:50 UTC
The language doesn't matter. It could be any of the C-family of languages, or Visual Basic.



What you need is Visual Studio, then drag and drop the User Interfaces onto the form, and there you have a GUI (Graphical User Interface).



If you use a button to activate an activity, you double-click the button to get to the "code-behind", and a "template" for that button will appear. You enter all the code that this button is required to do, then when you run the program, if you click on the GUI button on the form, it will perform the instructions for that button.



That's really all there is to programming a GUI, no matter which Visual Studio language you use.



Oh, yeah - widgets, etc. Sorry I missed that part of your question.



To write a Widget, you need to be really good at programming concepts. I don't mean which language you use, I'm talking about programming skills that transcend any particular language, and that only comes with lots of experience. You might want to start with something simple, such as a pop-up box that gives you a simple message when you click a GUI button.



Good luck in your programming endeavors.
Chris C
2008-10-06 08:19:39 UTC
Using libraries are to your benefit. :)

And can be to your detriment if they change them. :(



Using C#, you can readily create Windows applications that can easily work with either a Windows PC, or the Internet, or using an emulator (possibly) on a Unix type of PC.

Drag-n-drop is very quick and pretty painless.



I have customized a couple of basic Windows controls by adding enhancements to the base control (base controls like CEdit, CListBox, CListCtrl, etc.).





You can develop your own functions and classes to design your own GUIs, it just takes time.

I once had to add a "tooltip" mechanism to a UIMX application because no libraries were available within the system I was limited to. I inquired to several other people in the same company as to if they had knew of a tool that was readily available. There response was no. I picked up the UIMX documentation and managed to create a generic tooltip "widget" that could be used anywhere in the application in about 3 months. And it was dynamic enough to associate the tooltips to as many controls as was necessary, while keeping features like foreground/background color as an option, font choice including size, along with making sure that the tooltip didn't disappear off the screen if the window was pushed too far off in any given direction on the screen.
speeedeamon
2008-10-06 07:40:41 UTC
You can certain create GUI's for specific OS' like Window using the Win32 API and C. Or you can use MFC and C++ for Windows. These methods mean that your program ONLY works in Windows.



But using cross-platform frameworks like GTK, Qt, wxWidgets will allow you to create programs that will run in Linux, Windows, MAC..Qt is a C++ framework, while GTK is C.



You can use Python and wxPython which interfaces to wxWidgets to very easily create GUIs..



With the work being done on these frameworks, you DO want to use them to avoid re-inventing the wheel..specially things like GTK where you get access to advanced data structures in a nice way..


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...