Posted on 2008-11-15 01:55
chefZ 阅读(663)
评论(0) 编辑 收藏 引用
There are Model and Modelless, let's start from Model
class MyDialog : public wxDialog
{
:
}
MyDialog::MyDialog(wxFrame *parent)
: wxDialog(parent,
wxID_ANY,
wxT("Test dialog"),
wxDefaultPosition,
wxDefaultSize,
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE )
{
:
}
create on heap:
MyAskDialog dlg = new MyAskDialog(...);
create on stack:
MyAskDialog dlg(...);
Model Dialog:
ShowModal()Modelless
Show()
example:
1).
void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event) )
{
MyAskDialog dlg(this); //on stack
dlg.ShowModal(); //model
}
2).
void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event) )
{
MyAskDialog dlg(this); //on stack
dlg.Show(); //modelless
}
3).
void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event) )
{
MyAskDialog dlg = new MyAskDialog(...) ; //on heap
dlg.ShowModal(); //model
}
4).
void MyFrame::OnShowDialog(wxCommandEvent& WXUNUSED(event) )
{
MyAskDialog dlg = new MyAskDialog(...) ; //on heap
dlg.Show(); //modelless
}
Styles:
wxCAPTION
|
Puts
a caption on the dialog box.
|
wxDEFAULT_DIALOG_STYLE
|
Equivalent
to a combination of wxCAPTION, wxCLOSE_BOX and wxSYSTEM_MENU
|
wxRESIZE_BORDER
|
Display a resizeable frame around the
window.
|
wxSYSTEM_MENU
|
Display a system menu.
|
wxCLOSE_BOX
|
Displays a close box on the frame.
|
wxMAXIMIZE_BOX
|
Displays a maximize box on the dialog.
|
wxMINIMIZE_BOX
|
Displays a minimize box on the dialog.
|
wxTHICK_FRAME
|
Display a thick frame around the window.
|
wxSTAY_ON_TOP
|
The dialog stays on top of all other
windows.
|
wxNO_3D
|
Under Windows, specifies that the child
controls should not have 3D borders unless specified in the control.
|
wxDIALOG_NO_PARENT
|
By default, a dialog created with a NULL parent window will be given the application's
top level window as parent. Use this style to prevent this from happening
and create an orphan dialog. This is not recommended for modal dialogs.
|
wxDIALOG_EX_CONTEXTHELP
|
Under
Windows, puts a query button on the caption. When pressed, Windows will go
into a context-sensitive help mode and wxWidgets will send a wxEVT_HELP event
if the user clicked on an application window. Note that this is an extended
style and must be set by calling SetExtraStyle()
before Create is called (two-step construction).
|
wxDIALOG_EX_METAL
|
On
Mac OS X, frames with this style will be shown with a metallic look. This is
an extra style.
|
使用已有的 dialog
Inheritance diagram for wxDialog:
Related Generic classes:wxGenericColourButton
wxGenericDragImage
wxGenericFileButton
wxGenericFontDialog
wxGenericFontButton
wxGenericAboutDialog
wxGenericBrush
wxGenericColourDialog
wxGenericColour
wxGenericCollapsiblePane
wxGenericColourRefData
wxGenericComboCtrl
wxGenericDirDialog = wxDirDialog
wxGenericDirCtrlXmlHandler
wxGenericDirCtrl
wxGenericFileDirButton
wxGenericFindReplaceDialog
wxGenericImageList
wxGenericListCtrl
wxGenericMDIClientWindow
wxGenericMDIParentFrame
wxGenericMessageDialog
wxGenericPageSetupDialog
wxGenericPen
wxGenericPrintDialog
wxGenericPrintSetupDialog
wxGenericPropertyAccessor
wxGenericTreeItem
wxGenericTreeCtrl
wxGenericValidator
wxGenericValidator