Page 1 of 1

Get with Spinner Question

Posted: Fri Mar 07, 2008 11:14 pm
by Jeff Barnes
Hi Everybody,

I have a get (see below) that I want only entries from 8 to 120 in increments of 4. The only problem I have is that the user can manually type in a number that is not divisible by 4 (ex. they type 29)

How can I prevent the user from either manually entering a number (I still want them to use the spinner) or not accept a value unless it is divisible by 4 ??


Code: Select all

REDEFINE GET oGet  var nNumber  id 102 of oDlg PICTURE "999" ;
     SPINNER MIN 8 MAX 120  UPDATE

Posted: Sat Mar 08, 2008 12:31 am
by Antonio Linares
Jeff,

You can use the VALID clause for that purpose, as usual.

Just do the required checks from the VALID

Posted: Sat Mar 08, 2008 12:46 am
by James Bott
Jeff,

I think that the best control will not let the user enter an invalid number. I want to avoid telling the user that he/she has done something "wrong."

How about using a combobox instead. It has an incremental search that won't let the user enter an invaid value and you can preload it with the 30 valid values.

Another disadvange of a spinner is that user might have to click on it 30 times to get to the highest value.

Regards,
James

Posted: Sat Mar 08, 2008 3:14 pm
by Jeff Barnes
Hi James / Antonio,

Thanks for the replies.

I ended up using the MOD() function ... if there is a remainder then the number is not divisible by 4 :)

I just remember the last value and populate the field with it if the number entered number is invalid.