![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
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 ![]() |
|
|
|
|
|
#2 |
|
Sexy Programmer
|
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! |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
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: |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
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? |
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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 |
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
Hey!
Thanks for the reply! So you are saying that the macro is defined all over the place? No good! :mad: |
|
|
|
|
|
#8 | |
|
Caffeinated Neural Net
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 925
Rep Power: 4
![]() |
Quote:
![]()
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp |
|
|
|
|
|
|
#9 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
Ah of course! So theres not just definitions all over, just need to find the main one...
Coolio, will grep now! |
|
|
|
|
|
#10 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
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... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|