Slidy Sliders - help please (skid?)

BlitzMax Forums/MaxGUI Module/Slidy Sliders - help please (skid?)

Mark Tiffany(Posted 2007) [#1]
Okay, so how do I make sliders "slidy"? See the example below. I want it to be the case that when I drag the slider, the panel moves with it. At present, it just moves once I release the mouse button.

I *know* this is possible, because skid did it in his maxedit code editor. But despite rummaging in that code, I can't see how! Any ideas? Anyone? Am I being really stupid?




SebHoll(Posted 2007) [#2]
Two words - event hooks! ;-)

The basic idea is that the scrollbar generates events as you move the knob, but they are only added to the Blitz Event Queue after you release. To make matters worse, the action causes the program to go into a modal loop, one which is not left until you release the mouse button, at which point the program is allowed to carry on with its processing. If you want to catch all the events (as they happen) you need to use an Event Hook - which basically involves adding your own function to the internal Blitz list that Blitz calls when it catches an event.



Quick example for you that should hopefully show you what I mean. Check out Assari's EventHook MaxGUI Tutorial for more information.


Mark Tiffany(Posted 2007) [#3]
Ah, I did wonder whether event hooks might be the difference.

Is there any real reason why the slider events can't be posted to the queue in real-time? i.e. in the same way that mouse move events are?


SebHoll(Posted 2007) [#4]
Is there any real reason why the slider events can't be posted to the queue in real-time? i.e. in the same way that mouse move events are?

Mainly because on Windows, as the user is changing a slider's value, the OS enters a modal loop, which means that normal program execution isn't performed - however, event hooks are called from within the modal look and therefore can be used to intercept these events. Only when the mouse is released is normal execution resumed (i.e. your main program flow continues) and Blitz just posts the final slider value in the queue.


CS_TBL(Posted 2007) [#5]
It would be practical if each slider has 3 events it can send out: startsliding, sliding, stopsliding (or comparible names). Currently the only "event" we have is stopsliding, which can be read using a hook to mimic a 'sliding' event.


Mark Tiffany(Posted 2007) [#6]
It would be practical if each slider has 3 events it can send out: startsliding, sliding, stopsliding (or comparible names). Currently the only "event" we have is stopsliding, which can be read using a hook to mimic a 'sliding' event.

From what Seb says, I don't think that's quite true.

In polled mode (using WaitEvent), you're right, there is no extra event. But in when using EventHooks and WaitSystem, it seems that the events do come through.

Which still seems bizarre to me, but hey, that'll be Microsoft...