Page 1 of 1

Subscribing events to the scrollbar of a StaticText widget

Posted: Thu Jan 05, 2006 20:14
by Obliviere
I'm having trouble subscribing ... well... what the title says. I'm trying to create a given behaviour when clicking in the StaticText area, but this behaviour doesn't seem to spread to the scrollbar when it's enabled. Therefore, I want to directly or indirectly include the scrollbars in this behaviour. A couple of apparent problems have presented themselves to me though.

a) I have no way of accessing the scrollbar globally, since the WindowManager singleton can only get windows. Even if I cast it as a Scrollbar, I can't use the Scrollbar specific functions or anything (since it's being obtained as simply a Window and the compiler complains that a Window type doesn't have those specific functions).

b) My other approach would be to access the scrollbar through the StaticText widget. This becomes the same problem as above, but also the Scrollbar members are protected in the StaticText widget, so I would not be able to access them.

I haven't been able to find anything useful on the topic in the forums so far; am I even going about this the right way? Is there an easier way I can deal with the situation? Any tips or thoughts would be appreciated, thanks!

Re: Subscribing events to the scrollbar of a StaticText widg

Posted: Thu Jan 05, 2006 20:55
by Obliviere
To clarify the exact problems I'm running into:

If I take approach a:
CEGUI::Scrollbar* sb = (CEGUI::Scrollbar*)wmgr.getWindow(guiObjectName.c_str())->d_vertScrollbar;

The error is:
error C2039: 'd_vertScrollbar' : is not a member of 'CEGUI::Window'


Approach b:
CEGUI::StaticText* st = (CEGUI::StaticText*)wmgr.getWindow(guiObjectName.c_str());
st->d_vertScrollbar->activate();

The error is:
error C2248: 'CEGUI::StaticText::d_vertScrollbar' : cannot access protected member declared in class 'CEGUI::StaticText'