Window

I’ve tried creating a global variable in main.lua and it seems to be picked up in the screen that has the sliders but cannot seem to set it to anything else in the event for the slider. The global variable value remains the same! Uh? [import]uid: 9371 topic_id: 3276 reply_id: 11608[/import]

What is it you’re aiming for here? The state of the slider is basically the position of the slider within the viewport. That should not change if the parent display group is moved.

Matt. [import]uid: 8271 topic_id: 3276 reply_id: 11620[/import]

I’ve cracked it. What I wanted to do was have a global variable that kept the state of an option. Then initialise the slider with the value and update the variable when the slider is changed. I’ve done that now and it’s working. Thanks for your help and slider!

I wonder if you could create a widget that had a arrow on the left and an arrow on the right and a value in the middle. [import]uid: 9371 topic_id: 3276 reply_id: 11621[/import]

Sure; is there a standard UI control the widget would impersonate? I’m not sure I can picture what you’re describing - unless you’re talking about just placing an arrow image on either side of the slider. All the images in the slider are passed in as arguments, so you can customise it quite a lot…

Matt. [import]uid: 8271 topic_id: 3276 reply_id: 11627[/import]

Well was thinking of a slider that showed a value, so you could set it to 1,2,3,4 and 5

Does that exist already in the slider widget? [import]uid: 9371 topic_id: 3276 reply_id: 11629[/import]

I’ve been thinking of some extras. Snap to fixed points should easy.

M [import]uid: 8271 topic_id: 3276 reply_id: 11634[/import]

Ok, check the usual download link for a new slider. I’ve added the ability to define a step count. Take a look at port7 to see how to define it. The step count is the literal number of steps within the viewport. So, if you want the slider to snap between full left, full right and the centre set the step count to 3. I’ve not modified the foreground image, so you’ll have to pretend that there are mitre points or something. All in all it was a fairly easy change, though it did show that there are multiple callbacks being made for each move event. This should be ok if you simply check the previous callback value when received.

Other ideas I have are things like multiple sliders within the viewport, etc, but that one in particular would be very tricky and I don’t tend to code things like that without knowing exactly how it’s going to work before-hand. Please let me know any suggestions or if that would be particularly useful (I can’t honestly think of a use for it right now!)

Matt. [import]uid: 8271 topic_id: 3276 reply_id: 11643[/import]