Thanks for your reply, Ralph.
I added a zip file in the Files section called MVCTest.zip.
It contains a demo app to illustrate the MVC concept with wxWidgets.
The form contains a text box with a value, and 2 buttons: increment, decrement.
The project does not contain the events, though, because I am not sure how to do
it.
Who can help and make the app work? I guess there is more than one way to do it.
It could be interesting to discuss these.
You can post your solution to the Files section.
Thanks!
Kind regards,
Al
--- In wxMS_developers@yahoogroups.com, Ralph Pass <rppass@...> wrote:
>
> I derive my controller from Frame and put the events there. My view
> creates a view given a wxDC. My events pass relevant information to the
> model. The events also decide if it was such that the views need to be
> updated. It also checks the model to see if the model thinks the views
> need to be updated.
> Conceptually, I have the controllers separate from the models separate
> from the views.
>
> Ralph
>
> al_lo_ja wrote:
> >
> > Hello,
> >
> > I want a clear separation between the UI and the business logic.
> >
> > How do you achieve this? How do you organize your source files for
> > your applications? Which folders do you generally create?
> >
> > I have tried this for my first wxWidget application:
> > \main.cpp
> > \MyApp.h
> > \MyApp.cpp
> > \Controllers\MyAppController.h
> > \Controllers\MyAppController.cpp
> > \Models\MyAppModel.h
> > \Models\MyAppModel.cpp
> > \Views\MyMainWindow.h
> > \Views\MyMainWindow.cpp
> >
> > - main.cpp contains only DECLARE_APP(MyApp) and IMPLEMENT_APP(MyApp)
> > - the MyApp class inherits from wxApp. MyApp.cpp contains the OnInit
> > method and creates a MyAppController object
> > - the MyAppController object creates a MyAppModel object and a
> > MyMainWindow object
> > - MyAppModel is the core of the application and knows nothing about
> > the GUI
> > - MyMainWindow inherits from wxFrame and is the main window of the
> > application
> >
> > As you can see I've been trying to implement the MVC
> > (model/view/controller) pattern. But I don't know where's the best
> > place to put the event handlers.
> >
> > How do you organize your source files? Where do you catch events?
> >
> > Kind regards,
> > Al
> >
> >
>