News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

wxWidets app : just dialog

Started by killerbot, February 08, 2006, 09:28:49 PM

Previous topic - Next topic

killerbot

Can any experienced wx programmer tell me how to do the following :

- just a simple based dialog app (so no sdi/mdi/frame).
- what do I need to do with the xrc from (wxSmith) for this

I tried to adjust the wx project generated by CB from the wx template. Replacing the frame with a dialog, but I don't seem to be able to load the xrc.

Thanks for the info,
Lieven

byo

At the beginning I must warn that I had some problems with wxApps working with dialogs only. After closing dialog, the application still remains in memory. But I hope there's easy solution for that.

Ok, steps to create dialog-only application using wxSmith's wizard:


  • Create project using wizard and close project in C::B
  • open wxsmith/wxsmith.cfg file and change <frame wxs_file="MainFrame.wxs" ... to <dialog wxs_file="MainFrame.wxs" ...
  • Open wxsmith/MainFrame.wxs file and change <object class="wxFrame" name="MainFrame"> to <object class="wxDialog" name="MainFrame">
  • Open project in C::B - now You've got dialog instead of frame, change something in dialog to recreate code
  • in mainframe.cpp and mainframe.h replace all wxFrame to wxDialog

It worked for me, I've used 7 feb nightly build

And one suggestion - maybe it would be better to use wxFrame class and put panel into it and all components into that panel. This should behave alsomst exackly like dialog.

mandrav

QuoteAt the beginning I must warn that I had some problems with wxApps working with dialogs only. After closing dialog, the application still remains in memory. But I hope there's easy solution for that.

That's easy.

In App::OnInit() where you create the dialog, don't just Show() it but use ShowModal(). And after this, return false from OnInit().
Be patient!
This bug will be fixed soon...