Starting with Lua (episode 2)

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

xabila
Quite a regular
Quite a regular
Posts: 55
Joined: Tue Mar 10, 2009 09:39
Location: Bruxelles

Starting with Lua (episode 2)

Postby xabila » Wed Jun 10, 2009 17:51

i'm trying to add the Rollup on my window loaded by lua.

Code: Select all

local root = winMgr:loadWindowLayout("ppt.layout")

root:setMousePassThroughEnabled( true)
CEGUI.System:getSingleton():getGUISheet():addChildWindow(root)
   
function luaRollUp(e)
  local we = CEGUI.toWindowEventArgs(e)
  we.window:toggleRollup()
  if we.window:isRollup() then
  we.window:setText("ON ROLLUP OFF");
else
  we.window:setText("ON ROLLUP ON");
end
end
root:subscribeEvent("RollUpToggled","luaRollUp")
root:subscribeEvent("RollupToggled","luaRollUp")




So First it never entered on the function, maybe it's not RollUpToogled ? in c++ it's EventRollupToogled

So i tried to associate it to the CloseClicked

Code: Select all

root:subscribeEvent("CloseClicked","luaRollUp")


But now it crashed, because i guess i should cast it to FrameWindow but i don't know how to do that in lua :(

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Starting with Lua (episode 2)

Postby CrazyEddie » Sun Jun 14, 2009 10:28

The rollup event name is "RollupToggled".

To cast window types in Lua, use the casting helper, such as you did for the EventArgs. So, for a frame window, you might do:

Code: Select all

local fw = CEGUI.toFrameWindow( we.window )


HTH

CE.

xabila
Quite a regular
Quite a regular
Posts: 55
Joined: Tue Mar 10, 2009 09:39
Location: Bruxelles

Re: Starting with Lua (episode 2)

Postby xabila » Tue Jun 16, 2009 19:33

Ok thanks a lot


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests