Hello

I have created a small sample of using wxLua with xrc file.
The example is really trivial but I think it really show the power the
lua/wx/xrc combo

I would like such a sample to be in the samples directory

greetings

p.s. I also posted a while ago about xwLua
http://www.maemopeople.org/index.php/keesj/2007/02/07/p49#more49
It might be rewarding to know wxLua was running on the maemo platform

here is the sample
--layout.xrc
<?xml version="1.0" encoding="ascii"?>
<resource>
  <object class="wxFrame" name="ID_FRAME">
    <title></title>
    <object class="wxButton" name="ID_BUTTON">
      <label>Hello</label>
    </object>
  </object>
</resource>
--main.lua
#!/usr/bin/wxlua

frame        = nil
xmlResource   = nil

function error(message)
  wx.wxMessageBox(message,"",wx.wxOK + wx.wxICON_EXCLAMATION,wx.wxNull)
end

function buttonClicked(event)
  event:Skip()
  frame:Destroy()
  frame:Show(false)
end


function main()
  xmlResource = wx.wxXmlResourceGetDefault()
  xmlResource:InitAllHandlers()
  --layout.xrc was create with xrced
  xmlResource:Load("layout.xrc")

  frame = xmlResource:CreateFrame( wx.wxNull, "ID_FRAME")

  if not frame then
    error("Error loading xrc resources!");
    return
  end
  ID_BUTTON = xmlResource:GetXRCID("ID_BUTTON")
  frame:Connect(ID_BUTTON, wx.wxEVT_COMMAND_BUTTON_CLICKED, buttonClicked)
  frame:Show(true)
end

main()

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to