Like Tree1Likes
  • 1 Post By stahta01

GUI Help

This is a discussion on GUI Help within the C++ Programming forums, part of the General Programming Boards category; AHi, I'm trying to create a GUI and I've got some questions: 1.) How would I go about creating a ...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    4

    GUI Help

    AHi, I'm trying to create a GUI and I've got some questions:

    1.) How would I go about creating a GUI with multiple screens? To be more specific... picture an internet website which has a bunch of buttons which are labeled according to various pages that they will take you to... e.g. Home Page, Checkout Page etc. However, when you click on each of these buttons, not the whole screen reloads and just the content reloads. i.e. you don't refresh the whole page, but just half of it. How do I create something similar in C++? Using the toolbox which enables you to drag and drop stuff like buttons etc, I can create the buttons but I can't figure out how to link these buttons to various pages. I was thinking about using "tab control" but I don't think it will provide enough flexibility for my intended purpose i.e. I want to be able to place buttons in various locations of the GUI interface and not just at the top row of the GUI and have them take me to various desired pages.

    2.) Let's say I've created a button which says "test" on it. When I press that button, I want it to type "test" into a text box of my choice, how would I create something like this?

    EDIT: @ 1.) I was just thinking... is it possible to assign a button to various tabs on a TabControl thing?
    Last edited by Atomic_Sheep; 06-13-2011 at 06:28 AM.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    GUIs are produced with library toolkits. There are a variety of them. All of the questions you are asking will be specific to the API (application programming interface) for that toolkit, so you need to choose one first. Some popular cross-platform ones (meaning they can be run on windows/mac/linux) are:

    - GTK (linux native, C API, "gtkmm" is the C++ version)
    - qt (OSX native, C++ API)
    - wxWidgets (C++ API)

    "wxWidgets" is pretty clever because what it does is use one of the other libraries internally, depending on where it is being used (on windows it uses the native windows library, on linux it uses GTK, on mac it uses qt), meaning the look and feel of the GUI will be identical to the rest of the desktop. Which is to say, if you use GTK or qt on windows, your GUI will not exactly match the desktop.

    Windows has it's own native GUI library with a C++ API I think, I'm not familiar with it. Unlike GTK and qt it cannot be used anywhere except on windows.

    So google around, make a decision, and for all of the above there will probably be someone around here who is familiar with the library. HOWEVER, what I'd recommend is checking out a forum specific to the toolkit, because those also exist, and they are specifically for questions related to that particular GUI library. Eg, I know there is a forum for GTK, and a forum for wxWidgets, and both of them have enough traffic that any questions you ask will get answered in a reasonable amount of time by someone knowledgeable.

    The gtk forum:
    http://www.gtkforums.com/viewforum.php?f=3

    The wxwidgets forum:
    http://forums.wxwidgets.org/

    I'm getting a "server not found" for the last one right now, perhaps it is down. I haven't been there in about a month, it got a decent number of posts so I doubt it has disappeared permanently.

    I recommend wxWidgets, unless you are only interested in windows, in which case you might as well use their native thing.
    Last edited by MK27; 06-13-2011 at 07:35 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2,372
    Quote Originally Posted by MK27 View Post
    "wxWidgets" is pretty clever because what it does is use one of the other libraries internally, depending on where it is being used (on windows it uses the native windows library, on linux it uses GTK, on mac it uses qt), ...
    On Mac it uses GTK not qt; note it can also use X-Windows on Linux and Mac.

    The wxQt (wxWidgets using Qt as back end) port is in work and has a long way to go before it is finished.

    Tim S.
    MK27 likes this.

  4. #4
    Registered User
    Join Date
    Jun 2011
    Posts
    4
    Ideally, I want something that will work on Linux, Windows and Mac, however, I'm pretty much exclusively only familiar with windows at the moment so I'll probably use something like Visual Studio. I installed QT creator but the toolbox doesn't have some of the features which VB 2010 Express has which I'm sure are also present in the full version of Visual Studio. I was just too lazy to get the discs for it so installed Express for now. As I said, I'm pretty much a noob with all of this so for the time being, I'd prefer to stick to stuff that I'm most familiar with and learn compatibility and other langauges/APIs OS's later on when I'm a little bit more familiar with the way things should work in C++ and on Windows. So I suppose for the time being, let's assume my questions apply just to Visual Studio.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21