Did you use a frame or a dialog? For a dialog, you use
rc = UI.<your dialog variable name>:ShowModal()
For a frame:
UI.<your frame variable name>:Show()
----------------------------------------------------------------------------
-- Lua code generated with wxFormBuilder (version Aug 8 2018)
-- http://www.wxformbuilder.org/
----------------------------------------------------------------------------
-- Load the wxLua module, does nothing if running from wxLua, wxLuaFreeze, or wxLuaEdit
package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;"
require("wx")
UI = {}
-- create MyDialog1
UI.MyDialog1 = wx.wxDialog (wx.NULL, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxSize( 226,133 ), wx.wxDEFAULT_DIALOG_STYLE )
UI.MyDialog1:SetSizeHints( wx.wxDefaultSize, wx.wxDefaultSize )
UI.bSizer1 = wx.wxBoxSizer( wx.wxVERTICAL )
UI.bSizer2 = wx.wxBoxSizer( wx.wxHORIZONTAL )
UI.m_staticText1 = wx.wxStaticText( UI.MyDialog1, wx.wxID_ANY, "Steve:", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
UI.m_staticText1:Wrap( -1 )
UI.bSizer2:Add( UI.m_staticText1, 0, wx.wxALL, 2 )
UI.m_textCtrl1 = wx.wxTextCtrl( UI.MyDialog1, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
UI.bSizer2:Add( UI.m_textCtrl1, 1, wx.wxALL, 2 )
UI.bSizer1:Add( UI.bSizer2, 1, wx.wxEXPAND, 5 )
UI.m_sdbSizer1 = wx.wxStdDialogButtonSizer()
UI.m_sdbSizer1OK = wx.wxButton( UI.MyDialog1, wx.wxID_OK, "" )
UI.m_sdbSizer1:AddButton( UI.m_sdbSizer1OK )
UI.m_sdbSizer1Cancel = wx.wxButton( UI.MyDialog1, wx.wxID_CANCEL, "" )
UI.m_sdbSizer1:AddButton( UI.m_sdbSizer1Cancel )
UI.m_sdbSizer1:Realize();
UI.bSizer1:Add( UI.m_sdbSizer1, 1, wx.wxEXPAND, 5 )
UI.MyDialog1:SetSizer( UI.bSizer1 )
UI.MyDialog1:Layout()
UI.MyDialog1:Centre( wx.wxBOTH )
-- Connect Events
UI.m_sdbSizer1Cancel:Connect( wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event)
--implements m_Cancel()
event:Skip()
end )
UI.m_sdbSizer1OK:Connect( wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event)
--implements m_OnOk
event:Skip()
end )
--wx.wxGetApp():MainLoop()
To show the above dialog code:
rc = UI.MyDialog1:ShowModal()
rc will be wx.wxID_OK or wx.wxID_CANCEL, depending on what button was pressed.
The frame's Show() method isn't modal, as it is a top level window. Frame and dialogs each have their pros and cons.
Steve