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/
Sizers
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.
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:
- Some controls values
are fixed (eg wxStaticLine)
- Some controls have
parameters passed one way, from the main code to the dialog, eg
wxStaticText
- Some controls have
parameters that can be passed both ways eg wxTextCtrl
- Some controls
have parameters that can be passed both ways, but also have properties
(eg labels, sizes) which are not passed and for these you need to
expand the + signs in the dialog editor and edit the properties in the
boxes marked
eg wxRadioButton
- Some controls use
values passed in the constructors and once set these cannot be altered.
These are not handled by wxHatch at present
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 