Author Topic: wxWidets app : just dialog  (Read 2351 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
wxWidets app : just dialog
« on: February 08, 2006, 09:28:49 pm »
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

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxWidets app : just dialog
« Reply #1 on: February 10, 2006, 08:53:51 am »
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.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: wxWidets app : just dialog
« Reply #2 on: February 10, 2006, 09:04:04 am »
Quote
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.

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...