FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get with Spinner Question
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Get with Spinner Question
Posted: Fri Mar 07, 2008 11:14 PM
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 ??



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

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Get with Spinner Question
Posted: Sat Mar 08, 2008 12:31 AM

Jeff,

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

Just do the required checks from the VALID

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Get with Spinner Question
Posted: Sat Mar 08, 2008 12:46 AM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Get with Spinner Question
Posted: Sat Mar 08, 2008 03:14 PM

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.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion