wxHatch Reference: Dialog Editing in wxHatch

This dialog editor is intended to build dialogs by adding controls to sizers, which will look after the layout on each platform.
You can read about sizers, how to edit them manually and what all the parameters mean at http://neume.sourceforge.net/sizerdemo/

The default  inital state contains a main sizer, to which controls and or sizers are added, and a button sizer, which will have OK and Cancel buttons, laid out horizontally at the bootm of the dialog. You can edit its properties to have Yes/No buttons or vertical orientation instead.

You can add several kinds of box sizers using the toolbar on the left, or the right-click menu. Each sizer can contain other sizers or controls.

You can add controls using the toolbar - my favourites, or using the menus (eg right click). Once added the controls can be moved up-down (within a sizer) or left-right (across the sizer hierarchy).  You can adjust the tab order in the right-hand pane (possible bug). If you want to edit the spacing around the conrols, you need to edit the cpp file,  changing the default 5 pixel spacing in lines like
     mainsizer -> Add(staline, 0, wxALL | wxEXPAND, 5);

Any changes you make to the cpp file will be taken into account when you switch back to the dialog editor (and vice versa)

In the current wxHatch version [1.3] the simple controls, whose value can be set/get have been added to controls.ini. Controls in which the parameters are passed in the constructor (eg wxComboBox) cannot be used as with wxHatch at present. You can add to controls.ini if you have any other simple controls - its syntax is like other ini files with sections for each control.

The dialog is contained in 3 files,
mydialog.cpp mydialog.h and mydialog.inc. The latter file provides a means of incorporating the dialog into a full wxhatch (or other wxWidgets) project. You use Insert Dialog | Own dialog to use this file (see the Dialog editing Tutorial for examples). Once the dialog is included, you probably want to pass parameters to/from the dialog in and event handler. The code inserted into your project shows the types of the parametrs you can set/get

Dialog controls' parameters:
The complexity of a dialog and its controls is immense, and getting the parameters parsed [or passed] right is not trivial:
Event handlers
Most controls generate event when clicked. For buttons (eg wxButton, wxBitmapButton) handling these events is essentail if you want the dialog to respond when the button is clicked. wxHatch inserts an event handler into the dialog's cpp file (and the code in this handler is preserved even if the button is ssubsequently removed). You can edit this in the code pane to acheive your ends, but if you prefer to handle the event in your main program, just edit the event table, removing the line linking the button ID to the event handler.

Dialog sanity
wxhatch tries to keep the dialog sane, both by limiting the menu optios to times when they are appropriate, and by scanning the dialog once it has been edited. This latter check tests to see that all the controls are only used after they have been created with new, and that they are added to their sizer after they have been created.

Adding your own controls
You can add your own controls to the dialog editors' stock, or those downloaded from the net, to
codedir/controls.ini - see here for requirements, formats etc

wxHatch Home link to wxhatch help index