[ZeroBrane Studio] Running Sample wxLua Scripts

  • From: Roy Hinkelman <royhink@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Sun, 1 Feb 2015 14:37:35 -0800

I am trying to run a few of the wxLua sample scripts, specifically
minimal.wx.lua, which appeared to open correctly. However, when I tried to
add a wxMenuBar, it is not showing. Only the frame and the status bar shows.

I'm on OSX 10.9.5 / ZBS 0.611 / wxLua 2.8.12.3 / wxWidgets 3.1.0

My Code:
-- 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")
frame = nil
function main()
-- create the frame window
  frame = wx.wxFrame(
    wx.NULL, wx.wxID_ANY, "Window Sample",
    wx.wxDefaultPosition, wx.wxSize(450, 450),
    wx.wxDEFAULT_FRAME_STYLE )

  -- create a simple file menu
  local fileMenu = wx.wxMenu()
  fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program")

  -- create a simple help menu
  local helpMenu = wx.wxMenu()
  helpMenu:Append(wx.wxID_ABOUT, "&About",
                  "About the wxLua Minimal Application")

  -- create a menu bar and append the file and help menus
  local menuBar = wx.wxMenuBar()
  menuBar:Append(fileMenu, "&File")
  menuBar:Append(helpMenu, "&Help")

  -- attach the menu bar into the frame
  frame:SetMenuBar(menuBar)

  -- create a simple status bar (working)
  frame:CreateStatusBar(1)
  frame:SetStatusText("Welcome to wxLua.")


  -- show the frame window
  frame:Show(true)
end
main()
-- Call wx.wxGetApp():MainLoop() last to start the wxWidgets event loop,
wx.wxGetApp():MainLoop()



Roy

Other related posts: