Retrieve Scrollbar from loaded layout with CEGUI

cutterslade

12-06-2006 01:59:04

Hello all, I've just started with OgreDotNet and must say I am very impressed! However I'm having a little problem with CEGUI. I've loaded a layout (Demo8.layout from the CEGUI samples) and got it on screen, but I can't retrieve the ScrollBar object so I can associate events to it after the layout is loaded. I tried to get it with WindowManager.Instance.getWindow and cast it to a Scrollbar but this yelds compilation errors. What cand I do?

PS: I just saw this post which asks pretty much the same question as mine, but it never got answered :( . Is there no way to do this?

rastaman

12-06-2006 18:23:09

take a look at DemoCompoistor, in function cDemoCompositor.connectEventHandlers.

what you need to do is use the SWIG constructors. The first param is and IntPtr and the second param is a bool that you will pass a false to so the Scrollbar class does not try to delete the c++ object when it is Dispose. Use the static fucntion Window.getCPtr to get the IntPtr.


CeguiDotNet.Window w = WindowManager.Instance.getWindow("ExitDemoBtn");
mGuiBtnQuit = new PushButton( Window.getCPtr(w).Handle, false );
[/code

cutterslade

12-06-2006 22:28:56

Worked like a charm! Thanks a ton! :D