From: Francesco M. <f18...@ya...> - 2005-06-24 21:15:44
|
Hi, >>how should we provide dialog windows in our components ? >>Using XRC files, or just hard-coded classes that build the UI ? > I hard code them, the complicated pages are created using wxDesigner. > I try to make them reasonably extensible if at all possible. For > example, in wxStEdit I have a preferences dialog with 7 notebook > pages. Each page can be used independently of the others and of the > dialog that contains them. All I do is forward the Ok, Cancel, etc > buttons to the page before the dialog deals with them and if the page > handles it fine, if not, fine too. > > I think it's a good idea to at least separate the "page(s)" of the > dialog from the dialog since then it'll be reusable. You can also > provide flags to make it possible for users to get different varieties > or add a virtual function "CreateDialog" (or whatever) so that people > can subclass it and override it's behavior. In this case everyone will > have to call the "CreateDialog" function after creation (you can't > have virtual functions in the constructor). yes; that's exactly the approach I've taken with keybinder: I created some "build flags" to allow customization of appearance dialog and also I've divided the dialog construction in various virtual functions which should make easier dialog-customization.... > > XRC makes your user link to the XRC lib so I prefer not to use that. > It also won't make it any easier for them to reuse or change things > anyway. even if I think that it would be easier for the user to fine-tune the appearance of the dialog, I agree with you and Otto on the hardcode approach since it does not force the user to link to the XRC lib and is a (little) faster. Still I think that in future XRC will play a more important role in wx GUI programming... Francesco |