Page 1 of 1
Slider updating when thumb moves
Posted: Mon Aug 29, 2005 13:58
by SupSuper
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:
So that whenever the thumb's moved, the glow "follows" it, giving a better idea of its position.
Re: Slider updating when thumb moves
Posted: Tue Aug 30, 2005 09:00
by CrazyEddie
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.
Re: Slider updating when thumb moves
Posted: Tue Aug 30, 2005 15:43
by SupSuper
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

Re: Slider updating when thumb moves
Posted: Wed Sep 14, 2005 19:48
by SupSuper
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;
}
Re: Slider updating when thumb moves
Posted: Thu Sep 15, 2005 08:17
by CrazyEddie
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
Re: Slider updating when thumb moves
Posted: Thu Sep 15, 2005 15:30
by SupSuper
Thanks, it works now, though I still got another problem. Look here:
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?
Re: Slider updating when thumb moves
Posted: Fri Sep 16, 2005 08:23
by CrazyEddie
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.