Slider Issues?
BlitzMax Forums/BlitzMax Programming/Slider Issues?
| ||
It seems to start five and only go to 10. and how can I get it to use cont up by float instead of int. Just found out you must use the range function but how to use cont by floats like 0.5 |
| ||
Hi you need to use SetSliderRange(min, max) and SetSliderValue(value) to determine the limits and the starting value ' createslider.bmx Import MaxGui.Drivers Strict Local window:TGadget=CreateWindow("My Window",0,0,240,240,,WINDOW_TITLEBAR) Local stepper:TGadget stepper=CreateSlider(100,120,24,24,window,SLIDER_STEPPER) Local lbl_stepper:Tgadget=CreateLabel("Value: ---",10,120,80,24,window) SetSliderRange stepper,0,9 SetSliderValue stepper,0 While WaitEvent() Print CurrentEvent.ToString() Select EventID() Case EVENT_GADGETACTION Select EventSource() Case stepper SetGadgetText lbl_stepper,"Value: "+SliderValue(stepper) End Select Case EVENT_WINDOWCLOSE End End Select Wend Stepper values are always (internally) as Integer. You should need to change the range and manage the SliderValue() in a different way Import MaxGui.Drivers Strict Local window:TGadget=CreateWindow("My Window",0,0,240,240,,WINDOW_TITLEBAR) Local stepper:TGadget stepper=CreateSlider(150,120,30,30,window,SLIDER_STEPPER) Local lbl_stepper:Tgadget=CreateLabel("Value: ---",10,120,120,30,window) SetSliderRange stepper,0,99 '<--- see the new range SetSliderValue stepper,0 While WaitEvent() Print CurrentEvent.ToString() Select EventID() Case EVENT_GADGETACTION Select EventSource() Case stepper SetGadgetText lbl_stepper,"Value #" +Float(SliderValue(stepper))/10 '<--- see this count End Select Case EVENT_WINDOWCLOSE End End Select Wend |
| ||
I assume you have come across the image freezing as you drag the scroll bar. There is a really good thread on using event hooks for scrolling, that gets round this problem. The following is based on that thread. NOTE: This is based on work done by others in the forum, on a thread that I can't remember the name of. 'Current.JPG' is a 1200 by 900 pixel image. If your image is a different size set the variables 'CanvasWidth' and 'CanvasHeight' to match your image size. Have fun cps |