Hi Chad,
have started digging into the wxWidgets morass.....and surprise surprise I'm making some progress.
There are broadly speaking 19 different dialogs. The one in the code I have posted is an example of a FileDialog.
Other dialogs that may be useful to you and I are TextEntryDialog, NumberEntryDialog and MessageDialog.
I could never understand why it is for instance that it was necessary to have a Frame, called mainframe in my example,
and a panel within that frame, called panel in my example, but was not in fact used?
What I have learnt is that a dialog, essentially a bunch of code to do some nifty things, requires a parent structure because a fair
proportion of the code that does all that nifty stuff is inherited from the parent.
There again in the example posted 'mainframe' is the top level, note that its first parameter, usually its parent is wx.NULL,
ie no parent. Note that 'panel' which lives inside the frame has its first parameter as 'mainframe', so 'panel' parent
is 'mainframe' and 'panel' inherits code from 'mainframe'.
When I have defined 'file' as a FileDialog its first parameter or parent is 'panel'. So FileDialog 'file' inherits from both
'panel' its immediate parent but also from 'mainframe' as well.
It is possible to have a FileDialog WITHOUT a parent but then it misses out on all that code. For instance we know that
most windows can be resized by dragging the boundaries. That functionality is associated with Frame. Thus if we had
a FileDialog that does NOT inherit from a Frame then that resize functionality would be lost.
The next thing I have learnt is that while the FileDialog in my code is:
local file = wx.wxFileDialog(panel, "Select Data File", "", "", "Text files (*.txt)|*.txt|Tap files (*.tap)|*.tap",
wx.wxFD_SAVE,wx.wxDefaultPosition,wx.wxDefaultSize, "File Dialog" );
It does not DO ANYTHING YET. That is the purpose of the constructor.....in my example the constructor is:
file:ShowModal()
Its that statement that causes the defined file dialog to be displayed on screen.
If a Dialog has a constructor it also needs a destructor and in many cases when we hit <OK> or <Save> or <Yes>
in a Dialog window that triggers the destruction of the dialog.
Yes after spending a couple of hours reading and writing snippets of code to test what I've read its starting to make a
little sense!
Craig