Perfect Spinner Gadget

BlitzPlus Forums/BlitzPlus Programming/Perfect Spinner Gadget

JoshK(Posted 2005) [#1]
This was kind of a pain to write, but the results are 100% PERFECT.

The spinner gadget takes input from either a text field or a slider on the righthand side. The range can be between any two numbers, and can use any incremental value for the slider, including floats and irregular values. The slider activates and highlights the entire textfield text when hit. (Requires user32.dll SendMessage() for this behavior.)

This demonstrates the behavior:
http://www.leadwerks.com/post/spinner.zip



Get the source from the code section of my site, at the bottom of the "Tools" page:
http://www.leadwerks.com

Maybe Mark can add this as a native BlitzPlus gadget?


CS_TBL(Posted 2005) [#2]
hm.. hm..

what about this:

A canvas that shows a number and the number can be inc'd and dec'd by click/dragging the mouse on it..

Advantage: you don't have to pinpoint the mouse on the tiny up/down buttons.

..just an idea .. ^_^


JoshK(Posted 2005) [#3]
Updated to include wrapping values like angles. The slider also activates the text field when hit, so the number is highlighted.

CreateSpinner(x,y,width,height,group,min#=0,max#=100,increments#=1,flags=0)
x
y
width
height
group
min#
max#
increments#
flags
	1 - float values allowed (default is integer-only)
	2 - wrap values when min or max is reached



Beaker(Posted 2005) [#4]
An easy way to do these is to use GUIde which has them built in (user library):
http://www.playerfactory.co.uk


JoshK(Posted 2005) [#5]
Do your "GroupBox" gadgets use a canvas, or are they actual windows objects?


Beaker(Posted 2005) [#6]
Its not my tool (belongs to Wiebo), but it does use a canvas.


Cold Harbour(Posted 2005) [#7]
They work nice Halo.

Small thing I added:
Function disablespinner(hspinner)
        spinner.spinner=Object.spinner(hspinner)
	DisableGadget spinner\textfield
	DisableGadget spinner\slider
End Function

Function enablespinner(hspinner)
	spinner.spinner=Object.spinner(hspinner)
	EnableGadget spinner\textfield
	EnableGadget spinner\slider
End Function



Zakk(Posted 2009) [#8]
Thread necro, but I like the gadget.


hm.. hm..

what about this:

A canvas that shows a number and the number can be inc'd and dec'd by click/dragging the mouse on it..

Advantage: you don't have to pinpoint the mouse on the tiny up/down buttons.

..just an idea .. ^_^



Reminds me of PD.


schilcote(Posted 2009) [#9]
I think Windows has a box like that... I saw it in RPG Maker 2K3.