Spinner selected value

I have the value of a regular spinner input bound to a query.
Also, on property change of the spinner, I have an outbound update query.

I am dynamically setting my minimum value to be some number > 2.
However, The select query mostly will return a 0 which causes the arrow keys on my spinner to do nothing.

Is there a way to make something eg.(up arrow) make the value jump into the range of the spinner so the user doesn’t think it is broken?

I need 0s to be in the spinners that don’t have values in the database so setting ALL values of the spinners > 2 is not a good option.

Not sure if this is what you mean, but would this do it for you?

if event.propertyName=="intValue" and event.source.intValue>0 and event.source.intValue<2:
	event.source.intValue = 2

(You may want to also put an ‘if’ in the update query to avoid updating the value “1” first.)

[quote=“tduryee”]Not sure if this is what you mean, but would this do it for you?

if event.propertyName=="intValue" and event.source.intValue>0 and event.source.intValue<2:
	event.source.intValue = 2

[/quote]

I followed your example …I decided to turn off the poll rate of the select query and only do the update query if the new value is in the range that I want and unbound the min value and set them all to 0.
Setting the value to a new min value in the script works for me just how i wanted except upon closer examination:

suppose I have this as my prop change script on a spinner:

if event.source.intValue <= 3 : event.source.intValue = 4
When I get to the lower bounds… it goes past the value every 3rd click i think… anyone know a good workaround for this?

Strange - It sure does…
Maybe one of the Inductive people can give you a less hacky solution, but in the meantime, this will work.

def SetTo4(spinner=event.source):
	if spinner.intValue>0 and spinner.intValue<4:
		spinner.intValue=4
system.util.invokeLater(SetTo4, 1)

Another approach may be to change the “enabled” property of the spinner to false if the query returns a zero, and re-enable the property when you get a valid value from the database. This way you can keep the min/max bounds as well without trying to use a propertyChange event handler.