1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<HTML>
<head><title>Dialogs and controls</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="dialogscontrols"></A><CENTER>
<A HREF="port.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="port.htm"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="port7.htm#gdiobjects"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="port9.htm#dc"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>Dialogs and controls</H2>
<P>
<B><FONT COLOR="#0000C8">Labels</FONT></B><P>
Most controls no longer have labels and values as they used to in 1.xx. Instead, labels
should be created separately using wxStaticText (the new name for wxMessage). This will
need some reworking of dialogs, unfortunately; programmatic dialog creation that doesn't
use constraints will be especially hard-hit. Perhaps take this opportunity to make more
use of dialog resources or constraints. Or consider using the wxPropertyListView class
which can do away with dialog layout issues altogether by presenting a list of editable
properties.<P>
<B><FONT COLOR="#0000C8">Constructors</FONT></B><P>
All window constructors have two main changes, apart from the label issue mentioned above.
Windows now have integer identifiers; and position and size are now passed as wxPoint and
wxSize objects. In addition, some windows have a wxValidator argument.<P>
<B><FONT COLOR="#0000C8">Show versus ShowModal</FONT></B><P>
If you have used or overridden the <B>wxDialog::Show</B> function in the past, you may find
that modal dialogs no longer work as expected. This is because the function for modal showing
is now <B>wxDialog:ShowModal</B>. This is part of a more fundamental change in which a
control may tell the dialog that it caused the dismissal of a dialog, by
calling <B>wxDialog::EndModal</B> or <B>wxWindow::SetReturnCode</B>. Using this
information, <B>ShowModal</B> now returns the id of the control that caused dismissal,
giving greater feedback to the application than just TRUE or FALSE.<P>
If you overrode or called <B>wxDialog::Show</B>, use <B>ShowModal</B> and test for a returned identifier,
commonly wxID_OK or wxID_CANCEL.<P>
<B><FONT COLOR="#0000C8">wxItem</FONT></B><P>
This is renamed wxControl.<P>
<B><FONT COLOR="#0000C8">wxText, wxMultiText and wxTextWindow</FONT></B><P>
These classes no longer exist and are replaced by the single class wxTextCtrl.
Multi-line text items are created using the wxTE_MULTILINE style.<P>
<B><FONT COLOR="#0000C8">wxButton</FONT></B><P>
Bitmap buttons are now a separate class, instead of being part of wxBitmap.<P>
<B><FONT COLOR="#0000C8">wxMessage</FONT></B><P>
Bitmap messages are now a separate class, wxStaticBitmap, and wxMessage
is renamed wxStaticText.<P>
<B><FONT COLOR="#0000C8">wxGroupBox</FONT></B><P>
wxGroupBox is renamed wxStaticBox.<P>
<B><FONT COLOR="#0000C8">wxForm</FONT></B><P>
Note that wxForm is no longer supported in wxWindows 2.0. Consider using the wxPropertyFormView class
instead, which takes standard dialogs and panels and associates controls with property objects.
You may also find that the new validation method, combined with dialog resources, is easier
and more flexible than using wxForm.<P>
</BODY></HTML>
|