1. Idle Handler
---------------------------------------------------------------------------- -- Lua code generated with wxFormBuilder (version Oct 26 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") statusTimerValue = 0 statusIdleValue = 0 function TimerHandler (event) UI.m_statusBar:SetStatusText( string.format("Timer: %d", statusTimerValue), 0 ) statusTimerValue = statusTimerValue + 1 end function IdleHandler (event) UI.m_statusBar:SetStatusText( string.format("Idle: %d", statusIdleValue), 1 ) statusIdleValue = statusIdleValue + 1 end wxID_MENU_EXIT = 1000 wxID_TIMER = 1001 wxID_STATUS = 1002 UI = {} -- create wxDemo UI.wxDemo = wx.wxFrame (wx.NULL, wx.wxID_ANY, "", wx.wxDefaultPosition, wx.wxSize( 500,300 ), wx.wxDEFAULT_FRAME_STYLE+wx.wxTAB_TRAVERSAL ) UI.wxDemo:SetSizeHints( wx.wxDefaultSize, wx.wxDefaultSize ) UI.m_menubar1 = wx.wxMenuBar( 0 ) UI.m_menuFile = wx.wxMenu() UI.m_menuItemExit = wx.wxMenuItem( UI.m_menuFile, wxID_MENU_EXIT, "Exit", "", wx.wxITEM_NORMAL ) UI.m_menuFile:Append( UI.m_menuItemExit ) UI.m_menubar1:Append( UI.m_menuFile, "File" ) UI.wxDemo:SetMenuBar( UI.m_menubar1 ) UI.m_timer = wx.wxTimer(UI.wxDemo, wxID_TIMER) UI.bSizer1 = wx.wxBoxSizer( wx.wxVERTICAL ) UI.m_panel1 = wx.wxPanel( UI.wxDemo, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTAB_TRAVERSAL ) UI.bSizer1:Add( UI.m_panel1, 1, wx.wxEXPAND + wx. wxALL, 1 ) UI.wxDemo:SetSizer( UI.bSizer1 ) UI.wxDemo:Layout() UI.m_toolBar2 = UI.wxDemo:CreateToolBar( wx.wxTB_HORIZONTAL, wx.wxID_ANY ) UI.m_toolExit = UI.m_toolBar2:AddTool( wx.wxID_ANY, "Exit", wx.wxNullBitmap, wx.wxNullBitmap, wx.wxITEM_NORMAL, "", "") UI.m_toolBar2:Realize() UI.m_statusBar = UI.wxDemo:CreateStatusBar( 2, 0, wxID_STATUS ) UI.wxDemo:Centre( wx.wxBOTH ) --start UI.wxDemo:Show() UI.wxDemo:Connect(wx.wxEVT_TIMER,TimerHandler) UI.wxDemo:Connect(wx.wxEVT_IDLE,IdleHandler) UI.m_timer:Start(1000) statusValue = 0 --end wx.wxGetApp():MainLoop()
댓글 없음:
댓글 쓰기