FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to keep a valid from firing when you select a new radio
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
How to keep a valid from firing when you select a new radio
Posted: Fri Apr 27, 2018 04:39 PM
To All

I have an interesting problem.... I have 3 radio buttons with corresponding entry fields .. each of the fields have a when and valid clause ..

when I move the radio button from 1 to 2 the valid fires from the first radio button ... how do I keep the valid from firing when I move the cursor to a different radio button .. I only want the valid to fire when the cursor is in the entry field and the <enter> button is hit .. like an ON ENTER clause ??

Code (fw): Select all Collapse
 REDEFINE RADIO oRAD var nRAD ID 185, 187, 189, 191 of oWork ;
       ON CHANGE ( _ChkRadio( nRad,oRad,oL,oV,oD,@xL,@xV,@xD  ))

   REDEFINE GET oL var xL ID 186 of oWork PICTURE "@!";
   when  nRAD = 1  ;
   Valid _VehGet( oRsWork,cLicense,oLicense,@cVehEid,oVNUMBER,@cVNUMBER,oMAKE,@cMAKE,oTYPE,@cTYPE,oYEAR,;
                     @cYEAR,oSERIALNUMB,@cSERIALNUMB,;
                     oPROG,@cPROG,oEQUIP,@cEQUIP,@cProgEid,@cEquipEid,@cDepEid,@cDeputy,@cMotorPool,@cPoolID, "BUTTON",;
                     @cPropMaint,oPropMaint,nRad,@xL,@xV,@xD,oL,oV,oD) UPDATE


//----------------------------------
Static Func _ChkRadio( nRad,oRad,oL,oV,oD,xL,xV,xD )


Do Case
Case nRad = 1
   xL := space(8)
   xV := space(5)
   xD := space(7)

   oL:ReFresh()
   oV:ReFresh()
   oD:ReFresh()

   oL:Enable()
   oV:Disable()
   oD:Disable()

   SysReFresh()
   oL:SetFocus()
   Return(nil)

Case nRad = 2
   xL := space(8)
   xV := space(5)
   xD := space(7)

   oL:ReFresh()
   oV:ReFresh()
   oD:ReFresh()

   oL:Disable()
   oV:Enable()
   oD:Disable()

   SysReFresh()
   oV:SetFocus()
   Return(nil)

Case nRad = 3
   xL := space(8)
   xV := space(5)
   xD := space(7)

   oL:ReFresh()
   oV:ReFresh()
   oD:ReFresh()

   oL:Disable()
   oV:Disable()
   oD:Enable()

   SysReFresh()
   oD:SetFocus()
   Return(nil)

ENdCase

Return(nil)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to keep a valid from firing when you select a new radio
Posted: Fri Apr 27, 2018 09:01 PM

Rick,

you can add

nRad = 1 .AND. ...
nRad = 2 .AND. ...

and so on to the VALID of the corrispondent GET.

EMG

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: How to keep a valid from firing when you select a new radio
Posted: Fri Apr 27, 2018 09:27 PM

Enrico

I thought of that .. if you code When ( nRad = 1 .and. cVar = " ") .. you can not navigate into the field .. what I did as a work around is to take the focus off the Get so I rem'd out ( oL:Setfocus() ) so the Get field is not in focus .. that allowed me to be able to traverse the radio buttons without the valids firing .. However, I wanted to automatically set the get in focus during the ON radio change .. to keep the user from hitting TAB .. but once the get has focus .. there seems no way to traverse the radio buttons without the valid firing on nRad change.

I was hoping for a different solution .. but for now I have a work-around

Thanks
Rick Lipkin

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to keep a valid from firing when you select a new radio
Posted: Sat Apr 28, 2018 06:08 AM

Rick,

Maybe the solution is to use just the VALID of the dialog only

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion