SuperStrict 'import needed modules Framework wx.wxApp Import wx.wxFrame Import wx.wxComboBox Import wx.wxAui Import wx.wxTextCtrl Import wx.wxTreeCtrl Import wx.wxSpinCtrl Import wx.wxButton Import wx.wxBitmapButton Import wx.wxStaticText Import wx.wxArtProvider Import wx.wxColourDialog 'consts Const wxDEFAULT_NO_RESIZE:Int = wxSYSTEM_MENU | wxMINIMIZE_BOX | .. wxMAXIMIZE_BOX | wxCLOSE_BOX | wxCAPTION | wxCLIP_CHILDREN | wxBORDER_STATIC 'global vars 'App stuff Type MyApp Extends wxApp Field frame:myFrame Field box1:wxComboBox Method OnInit:Int() 'create window and show it frame = myFrame(New myFrame.Create(,,"POS Tracker", 200, 200, 800, 600, wxDEFAULT_NO_RESIZE)) frame.show() 'return successful Return True End Method End Type 'The window Type myFrame Extends wxFrame 'fields 'constants Const menu_Exit:Int = 201 Const tb_Add:Int = 202 Const tb_Remove:Int = 203 Const win_posadd:Int = 204 Const but_ok1:Int = 205 Field Addpos:wxDialog 'on start up... Method OnInit() 'MENU BAR Local mb:wxMenuBar = New wxMenuBar.Create() Local fileMenu:wxMenu = New wxMenu.Create() fileMenu.Append(menu_Exit, "Exit") mb.Append(fileMenu,"File") SetMenuBar(mb) 'STATUS BAR CreateStatusBar() SetStatusText("Welcome to the POS Tracker!") 'Create the Add POS sub window Addpos = New wxDialog.Create_(Self,wxID_ANY , "Add POS",200 ,200 , 500, 300, wxSTAY_ON_TOP| wxDEFAULT_DIALOG_STYLE) 'toolbar Local tb1:wxToolBar = New wxToolBar.Create(Self, wxID_ANY, ,, ,, wxTB_FLAT | wxTB_NODIVIDER | wxTB_HORZ_TEXT) tb1.SetToolBitmapSize(20, 20) tb1.AddTool(tb_Remove, "Remove POS", wxArtProvider.GetBitmap(wxART_ERROR,,20,20)) tb1.AddTool(tb_Add, "Add POS", wxArtProvider.GetBitmap(wxART_ADD_BOOKMARK,,20,20)) tb1.Realize() Local ok:wxButton = New wxButton.Create(Addpos,wxID_OK,"Ok") 'EVENT HANDLING Connect(menu_Exit, wxEVT_COMMAND_MENU_SELECTED, OnExit) Connect(tb_Add, wxEVT_COMMAND_TOOL_CLICKED, AddPOSWindow) ' Connect(but_ok1, wxEVT_COMMAND_BUTTON_CLICKED, AddPOS) End Method 'a function to handle exiting... Function OnExit(event:wxEvent) wxFrame(event.parent).Close(True) End Function 'show ADD POS window Function AddPOSWindow(event:wxEvent) MyFrame(event.parent).Addpos.ShowModal() End Function 'Adds a POS / ends the the dialog 'Function AddPOSOK(event:wxEvent) 'MyFrame(event.parent).Addpos.EndModal() 'End Function End Type 'run the program New MyApp.run()
If you create a default wxOK button, EndModal() is called implicitly.