Events not firing when setting value through code

AshMcConnell

08-06-2010 12:42:45

Hi Folks,

Is there any way to force the eventScrollChangePosition even to be fired when calling setScrollPosition on a HScroll. I am trying to create a Slider with "Up" and "Down" buttons and a label. I have registered an event handler to handle the eventScrollChangePosition event in order to set the label when clicking the Up and Down buttons (and dragging the slider).

Is this the "normal" way of doing this? Perhaps I should call the event handler directly? Or is there a better way?

Thanks for your help
All the best,
Ash

Altren

08-06-2010 14:42:28

When you call setScrollPosition you already know that it was changed and usually you don't need callback in such cases. Also such things might cause recursion when scroll position changes inside event.
So you should call event manually.
scroll->eventScrollChangePosition(scroll, scroll->getScrollPosition());
But better to call your code directly.

AshMcConnell

08-06-2010 14:50:03

Ok, fair enough. Makes sense.

Thanks for your help!
All the best,
Ash