Page 1 of 1

How to keep a valid from firing when you select a new radio

Posted: Fri Apr 27, 2018 4:39 pm
by Rick Lipkin
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 ..
Image
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: Select all | Expand


 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)
 

Re: How to keep a valid from firing when you select a new radio

Posted: Fri Apr 27, 2018 9:01 pm
by Enrico Maria Giordano
Rick,

you can add

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

and so on to the VALID of the corrispondent GET.

EMG

Re: How to keep a valid from firing when you select a new radio

Posted: Fri Apr 27, 2018 9:27 pm
by Rick Lipkin
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

Re: How to keep a valid from firing when you select a new radio

Posted: Sat Apr 28, 2018 6:08 am
by Antonio Linares
Rick,

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