Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 31st, 2007, 9:13 AM   #1
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
wxWidgets and practical apps.

Hey!

I was just wondering what the general guidelines to creating a GUI app are. I mean, it seems a little stupid to put all application code in one huge source file, are there any design strategies that make the process more "modular" (for lack of better term)...

Sorry if I seem a little unclear?

Hope you can help!

Ta
rwm is offline   Reply With Quote
Old Aug 31st, 2007, 9:48 AM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 3 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Browse through the Finished Projects section and take a look at how people create their GUI apps. I have a huge source file, unless it's a custom dialog or I make up some special type of button, etc., that contains all of my GUI components and events.
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Aug 31st, 2007, 10:03 AM   #3
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
Oh ok... Huge gnarly and messy source file

No good!

How do you setup the communication between GUI and the application code?

So far found this pattern Model-View-Controller Pattern...

God GUI programming is a major pain in the ass! :mad:
rwm is offline   Reply With Quote
Old Aug 31st, 2007, 10:10 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
One makes a project modular for the programmer(s) and for efficiency. I'm not one of those who thinks every function should be in a separate file, but a file should be relatively comprehensible in its entirety.

For large programs (I imagine my idea of a large program is a little different from the average member's), incorporating changes is faster if source files are smaller. One only has to compile those files that have been changed, then relink.

One might consider the GUI to be a single piece, but that isn't necessarily the case. The code that represents the action for some event may have no relationship to that for another event. Code for generation a report, for instance, should not be in the same file as code for ramping up the motor speed according to some rate curve. Both, however, interface to the GUI for input and output/display.

As for GUI programming being a pain in the ass, I disagree. Try making a really slick and easy to use console app for something other than a trivial hobby-type program.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Sep 3rd, 2007, 6:27 AM   #5
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
Heya!

Mmm, i'm still trying to find how to implement the application without having to resort to macros...

You know, the IMPLEMENT_APP macro and stuff...

I've looked in defs.h, not there?
rwm is offline   Reply With Quote
Old Sep 3rd, 2007, 8:13 PM   #6
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
wxWidgets uses quite a few macros I would get use to them. If you wish to really understand the source code more, you should download it and use a tool to do text searches over it. It really impossible without something like grep to find every place in the wxWidgets source where "IMPLEMENT_APP" is (and with that information find the place where its defined).
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Old Sep 4th, 2007, 3:19 AM   #7
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
Hey!

Thanks for the reply! So you are saying that the macro is defined all over the place?

No good! :mad:
rwm is offline   Reply With Quote
Old Sep 4th, 2007, 6:04 AM   #8
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,010
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by rwm
So you are saying that the macro is defined all over the place?

No good! :mad:
I think what was meant was that if you can find every occurrence, something grep will definitely help with, one of them will be the definition.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is online now   Reply With Quote
Old Sep 4th, 2007, 6:34 AM   #9
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
Ah of course! So theres not just definitions all over, just need to find the main one...

Coolio, will grep now!
rwm is offline   Reply With Quote
Old Sep 4th, 2007, 7:07 AM   #10
rwm
Professional Programmer
 
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2 rwm is on a distinguished road
found it in app.h

// Use this macro if you want to define your own main() or WinMain() function
// and call wxEntry() from there.
#define IMPLEMENT_APP_NO_MAIN(appname)                                      \
    wxAppConsole *wxCreateApp()                                             \
    {                                                                       \
        wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE,         \
                                        "your program");                    \
        return new appname;                                                 \
    }                                                                       \
    wxAppInitializer                                                        \
        wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp);        \
    DECLARE_APP(appname)                                                    \
    appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); }

seems to be what i want...
rwm is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:53 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC