FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GET with SPINNER
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
GET with SPINNER
Posted: Thu Jul 04, 2019 09:04 AM
I want to specify start and end number ranges via Spinner and show the number of records that match the various ranges
entered as the Up or Down key is selected (example below)

Presumably while I just press the UP or DOWN arrow it's still in focus and the VALID clause isn't getting called.

Calling it via ON UP and ON DOWN just prevents the Spinner from working

Thanks
Peter

Code (fw): Select all Collapse
#Include "FiveWin.Ch"


Function Main()
   Local oDlg
   Local oGet1
   LOCAL oGet2
   LOCAL nStart := 0
   LOCAL nEnd   := 0
       
  USE CUSTOMER NEW  SHARE

   DEFINE DIALOG oDlg FROM 100,100 TO 400,400 PIXEL
   
   @ 2,1  GET oGet1 VAR nStart PICT "99" SPINNER  VALID  Selected(nStart,nEnd)
   @ 2,10 GET oGet2 VAR nEnd   PICT "99" SPINNER  VALID  Selected(nStart,nEnd)
     
   ACTIVATE DIALOG oDlg 
 
 return nil
 
    FUNCTION Selected(nStart,nEnd)
LOCAL nSelected := 0

DBGOTOP()
 DO WHILE  ! EOF()
       IF   nStart <= CUSTOMER->AGE .AND.  nEnd  >= CUSTOMER->AGE 
                nSelected++
      ENDIF

DBSKIP()
ENDDO
@ 14,15 SAY STR(nSelected)+" selected"

RETURN .T.
Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: GET with SPINNER
Posted: Thu Jul 04, 2019 09:59 AM

Try with ON CHANGE

Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: GET with SPINNER
Posted: Thu Jul 04, 2019 12:56 PM

Thanks

Peter

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: GET with SPINNER
Posted: Fri Jul 05, 2019 04:46 PM
Peter,
a much faster solution :

instead of using a spinner ( it takes to long scrolling on two gets )
opening only one xbrowse with a range-selection of ages ( array )
define a range with 2 clicks for the start- and end-value.
The higher value will move to the second get
The image shows that the startvalue 33 is moved to the 1. get
After the 2. click the xbrowse will be closed ( hide )
and the final result is shown.

because of start and end = 0 by default, the first selection is moving to the 2. get
the position can change after the 2. selection.



if You like it smaller :



regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 50
Joined: Tue May 16, 2017 12:19 PM
Re: GET with SPINNER
Posted: Mon Jul 08, 2019 08:41 AM

Thanks for that Uwe

I can definitely see the merits in this for selecting from a short range of numbers but I have one range between 0-99999
a couple in four figures and a percentage range with decimal places.

In most cases the intial numbers will be entered via the keyboard and the spinner option is to provide "fine tuning" of
the selected number range.

However currently when using the spinner if a range is in error, i.e. start > end ,allthough the get
still has focus,it doesn't prevent moving the cursor to other Spinners/Xbrowses on the dialog

Regards
Peter

Continue the discussion