Problem: Adding controls with LUA

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Habba
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Tue Sep 19, 2006 15:21
Location: Finland
Contact:

Problem: Adding controls with LUA

Postby Habba » Wed Feb 14, 2007 17:42

Right. I have a problem with adding a button with LUA code. It gives no error, and the rest of XML-layout is loaded just fine. Here's the code:

Code: Select all

function loadUI()
   --set up some general CEGUI variables
    local winMgr = CEGUI.WindowManager:getSingleton()
    local logger = CEGUI.Logger:getSingleton()
    local system = CEGUI.System:getSingleton()
   
   --variables for my gui
    local layout = winMgr:loadWindowLayout("Screen.xml")
   local GWin = winMgr:getWindow("GameWindow")
    local area = winMgr:getWindow("Area")
   
   --set GUI sheet, and make GameWindow invisible (it will be shown later)
    layout:setVisible(true)
   system:setGUISheet(layout)   
   GWin:setVisible(false)         
   
   --Create button and set it's properties.
   local tempbox = winMgr:createWindow("TaharezLook/Button", "myButton")
   area:addChildWindow(tempbox)
   tempbox:setPosition(CEGUI.Size(0.5,0.5))
   tempbox:setSize(CEGUI.Size(0.2, 0.2))
   tempbox:setVisible(true)
   tempbox:setText("myButton")
   tempbox:setClippedByParent(false)
   tempbox:isAlwaysOnTop(true)
   
   return 0
end


Any ideas why I can see the GameWindow and Area just fine, but what I can't see is the button I've created.

Return to “Help”

Who is online

Users browsing this forum: No registered users and 23 guests