Slider updating when thumb moves

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
SupSuper
Just popping in
Just popping in
Posts: 17
Joined: Mon Feb 07, 2005 16:17
Location: Portugal
Contact:

Slider updating when thumb moves

Postby SupSuper » Mon Aug 29, 2005 13:58

Is there a way to get all the sliders in my UI to redraw whenever the thumb's moved, without having to add code to each of them?
You see, the sliders look like this:
Image
So that whenever the thumb's moved, the glow "follows" it, giving a better idea of its position.

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

Re: Slider updating when thumb moves

Postby CrazyEddie » Tue Aug 30, 2005 09:00

There's nothing for this at the moment, though you could subscribe the global event for a slider position change, extract the source window and manually trigger a redraw. So you'd have to add some code, but not for every slider.

Is this using falagard? If so I think I'll change the slider in there so that moving the thumb position will trigger a redraw of the whole widget. Or, more likely, add a configurable option.

User avatar
SupSuper
Just popping in
Just popping in
Posts: 17
Joined: Mon Feb 07, 2005 16:17
Location: Portugal
Contact:

Re: Slider updating when thumb moves

Postby SupSuper » Tue Aug 30, 2005 15:43

CrazyEddie wrote:
There's nothing for this at the moment, though you could subscribe the global event for a slider position change, extract the source window and manually trigger a redraw. So you'd have to add some code, but not for every slider.

Is this using falagard? If so I think I'll change the slider in there so that moving the thumb position will trigger a redraw of the whole widget. Or, more likely, add a configurable option.
Of course, I forgot about the global event, thanks for the suggestion :)

And yes it is using Falagard, all my widgets are now, it's awesome :D

User avatar
SupSuper
Just popping in
Just popping in
Posts: 17
Joined: Mon Feb 07, 2005 16:17
Location: Portugal
Contact:

Re: Slider updating when thumb moves

Postby SupSuper » Wed Sep 14, 2005 19:48

Sorry about double-posting and such, but I've got a problem. I've set up the global event to redraw the slider when changed, only... it doesn't work. It might be because the code is partially made of copy+pasting other existing code on the application since I'm not a very good coder, but it compiles fine:

Code: Select all

CEGUI::GlobalEventSet::getSingleton().subscribeEvent(CEGUI::Slider::EventValueChanged, CEGUI::Event::Subscriber(UITest::Slide,this));

bool UITest::Slide(const CEGUI::EventArgs& e)
{
   CEGUI::Window* slide = ((CEGUI::WindowEventArgs*)&e)->window;
   slide->requestRedraw();

   return true;
}

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

Re: Slider updating when thumb moves

Postby CrazyEddie » Thu Sep 15, 2005 08:17

The global event set required the event string to be prepended with an approperiate event namespace. This is because multiple widget types may define an event with the same name, so we needed a means of identifying the correct event.

So the event to subscribe is:

Code: Select all

Slider::EventNamespace + "/" + Slider::EventValueChanged


HTH

CE

User avatar
SupSuper
Just popping in
Just popping in
Posts: 17
Joined: Mon Feb 07, 2005 16:17
Location: Portugal
Contact:

Re: Slider updating when thumb moves

Postby SupSuper » Thu Sep 15, 2005 15:30

Thanks, it works now, though I still got another problem. Look here:
Image
Now, the glow is set as a FrameComponent which tiles vertically and horizontally. So why are the top-middle and bottom-middle parts being stretched?

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

Re: Slider updating when thumb moves

Postby CrazyEddie » Fri Sep 16, 2005 08:23

As stated in the docs for falagard, the formatting options for FrameComponent affect the background image, they do not affect the egdes of the frame. To tile the edges you need to build the frame yourself using ImageryComponents.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: Bing [Bot] and 10 guests