Hey all. Does anyone knows where to get some good tutorials of programming C++ Graphical User Interface? If so, please kindly send a PM and include your contact or reply here. Your help willl be appreciated. Thank you.

Xizhe

Recommended Answers

All 47 Replies

Use third party API's if you want your application to be platform independent or use the Win32 API if programming under windows. If using Windows, using C# would be more like it if there is no compulsion on using Win32 API or MFC.

Here is one of those third party API.

What do you mean?

If you are using Windows, then you can use the Windows API to complete your task. Otherwise, for cross platform GUI Programming (for Linux/UNIX/Mac) use something else like Tcl/Tk or Qt4.

Okay. Thanks.

No problem. I hope you become good at GUI C++ programming. We need more C++ programmers...

why do you want to become a gui or graphical programmer? Its really not as fun as it initially sounds..

in c++, yeah it sucks

in c# it's rewarding, and useful in the real world.

Well, I'm still a novice in IT programming world. If you say so, I would like to try that out. But people says C++ is more useful. Anymore suggestion? Maybe I should learn both. Now I'm currently learning C++ console programming, but I still haven't got the basis of it.

IMHO, C++ is not exactly an ideal language for someone starting out with programming. Starting out with Python would be more like it. Once you start getting a hang of how things work, jumping on to C/C++ would be more rewarding. Not to mention Python makes it easier for one to develop GUI applications -- easier than C++.

in my opinion gui programming is waste of time. Its not exactly easy to do it in c++. With gui programming you find yourself spending more time designing the gui then actually developing your programming.

You are under the misconception that GUI programming implies placement of various graphical components. Its not that simple. For placing Graphical components, you can always use IDE's which offer the feature of drag and drop. GUI programming brings with it concepts like events, multi threading and what not.

And the ones you are referring to are called GUI designers, not GUI programmers.

oh..never realized there was drag and drop gui development. The same applies to graphical programming in general, such as SDL or ALLEGRO.

Again you are getting confused. The last time I checked, Allegro and SDL were more used for game development and are called game programming libraries / game programming API's, not to be confused with GUI libraries. They don't have the concept of 'drag and drop' as such.

The programmer uses those libraries since it provides a easy wrapper around the core DirectX / OpenGL API calls.

yeah, but people also make gui applications with xlib. Allegro and SDL could be used for gui development.

Basically what I am saying is that non-console programming, whether it be gui or game development is not particularly fun or interesting as it seems at first.

Game development is not fun !! You have got to be joking. And BTW, 'fun' doesn't fetch you revenue, if you must know that...

I did not say game development was not fun.. I said graphical game development is not fun. Programming text based MUDs and nethack like games are extremely fun. After you have finished the text based base, then you can do you start the boring and tedious process of writing a front end for the game.

commented: utter nonsense. Try it before you knock it. +9

Well, I'm still learning C++ console. Just planning to learn GUI after console. Maybe I'll try C# out. Beside, people says python isn't that useful. What's your opinion?

python is soooo... easy compared to c/c++. I hacked this python application wifi-radar without any previous knowledge of python! You can do amazing games with python in a very short amount of time. Supposedly this kid from my local linux group made this pretty sweet galaga clone after learning python a month before! Try doing that with c++. But then again, pythons a bit slow....(though its nice not to have to compile)

Do you mind to introduce python?

I mean more specifically.

I dont really know it python.......but it looks like this:

def run( self ):
        self.dialog.show_all()
        return self.dialog.run()

    def destroy( self ):
        self.dialog.destroy()
        del self.dialog

    def toggle_use_dhcp( self, widget, data = None ):
        expanded = self.dhcp_expander.get_expanded()
        if expanded:
            self.dhcp_expander.set_label( USE_IP_LABEL )
        else:
            self.dhcp_expander.set_label( USE_DHCP_LABEL )

    def toggle_use_wpa( self, widget, data = None ):
        expanded = self.wpa_expander.get_expanded()
        if expanded:
            self.wpa_expander.set_label( USE_WPA_LABEL )
        else:
            self.wpa_expander.set_label( NO_WPA_LABEL )

    def get_profile( self ):
        profile                    = {}
        profile['ssid']            = self.ssid.get_text().strip()
        profile['key']            = self.key.get_text().strip()
        profile['mode']            = self.get_array_item( self.mode.get_active(), WIFI_MODES )
        profile['security']        = self.get_array_item( self.security.get_active(), WIFI_SECURITY )
        profile['channel']        = self.get_array_item( self.channel.get_active(), WIFI_CHANNELS )
        profile['protocol']        = 'b'
        profile['signal']        = '0'
        profile['prescript']    = self.prescript.get_text().strip()
        profile['postscript']    = self.postscript.get_text().strip()
        # wpa
        use_wpa                 = ( self.wpa_expander.get_expanded() == False )
        if use_wpa:
            profile['use_wpa'] = False
        else:
            profile['use_wpa'] = True
            profile['wpa_driver']= self.wpa_driver.get_text().strip()
        # dhcp
        use_dhcp                 = ( self.dhcp_expander.get_expanded() == False )
        if use_dhcp:
            profile['use_dhcp'] = True
        else:
            profile['use_dhcp'] = False
            profile['ip']        = self.ip.get_text().strip()
            profile['netmask']    = self.netmask.get_text().strip()
            profile['gateway']    = self.gw.get_text().strip()
            profile['domain']    = self.domain.get_text().strip()
            profile['dns1']        = self.dns1.get_text().strip()
            profile['dns2']        = self.dns2.get_text().strip()
        return profile

    def set_profile( self, profile, known ):
        if __debug__:
            print profile
        self.ssid.set_text( profile['ssid'] )
        if known:
            self.ssid.set_editable( False )
            self.dialog.set_title( "WiFi Profile for %s" % profile['ssid'] )
        self.key.set_text( profile['key'] )
        self.mode.set_active( self.get_array_index( profile['mode'], WIFI_MODES ) )
        self.channel.set_active( self.get_array_index( profile['channel'], WIFI_CHANNELS ) )
        self.security.set_active( self.get_array_index( profile['security'], WIFI_SECURITY ) )
        #self.protocol.set_text( profile['protocol'] )
        self.prescript.set_text( profile['prescript'] )
        self.postscript.set_text( profile['postscript'] )
        # wpa
        if profile['use_wpa'] == True:
            self.wpa_expander.set_expanded( True )
            self.wpa_driver.set_text( profile['wpa_driver'] )
        else:
            self.wpa_expander.set_expanded( False )
        # dhcp
        if profile['use_dhcp'] == True:
            self.dhcp_expander.set_expanded( False)
        else:
            self.dhcp_expander.set_expanded( True )
            self.ip.set_text( profile['ip'] )
            self.netmask.set_text( profile['netmask']    )
            self.gw.set_text( profile['gateway'] )
            self.domain.set_text( profile['domain'] )
            self.dns1.set_text( profile['dns1'] )
            self.dns2.set_text( profile['dns2'] )

    def get_array_index( self, item, array ):
        try:
            return array.index( item.strip() )
        except:
            pass
        return 0

    def get_array_item( self, index, array ):
        try:
            return array[ index ]
        except:
            pass
        return ''

thats a code snippet from wifi-radar.

And what did you mean by "It's nice not to have to compile it"? Did you mean something like after typing codes and straight away save as type executable file format? Or other type of "compilation"?

Yes something like that. Python is basically a scripting language which means it is an interpreted language. You don't need to compile the program. Just type and run it !! Thats why Python is used for quick prototyping of small projects.

its kind of nice. With big projects compiling can take a while. But with python your ready to go! But alas, like all scripting languages is not what you would call a "high performance langauge." At least its portable ;-)

Its a misconception among many people. They always talk about performance without knowing the actually implications of what they are saying considering 80% of the people who cry about performance run no real test or profile their code.

Come on, I mean there has to be some difference between C and Python. But think of it this way, I would rather write a small text based RPG game in Python in one week and have 95% performance than spend 3 weeks writing it in C and have 100% performance benefits.

With the kind of benefits Python offers over its fast counterparts, its kind of acceptable. I mean, you can't have everything, can you ? ;-)

Well, thanks. Any suggestion about some must-know or must-do or must-learn before starting python?


Come on, I mean there has to be some difference between C and Python. But think of it this way, I would rather write a small text based RPG game in Python in one week and have 95% performance than spend 3 weeks writing it in C and have 100% performance benefits

Yeah in that example I would use python too.(unless I was programming the RPG to improve my c/c++ skills) But even so performance matters! For example: I do some programming for the ARM (at least I think it is) based gp2x, and performace is the only thing that matters.

Well, thanks. Any suggestion about some must-know or must-do or must-learn before starting python?

I know this may seem odd but some programmers just do not respect python, ruby, perl, and even java to some extent.
They see "c/c++" as the hardcore programming language and anything other language short of assembly and maybe lisp noobish.

Well, lots of people say that C/C++ is more useful. That's why I am learning.

it is in the "real world"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.