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

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

Postby Rick Lipkin » Fri Apr 27, 2018 4: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 ..
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 view

 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)
 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

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

Postby Enrico Maria Giordano » Fri Apr 27, 2018 9:01 pm

Rick,

you can add

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

and so on to the VALID of the corrispondent GET.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

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

Postby Rick Lipkin » Fri Apr 27, 2018 9: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

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

Postby Antonio Linares » Sat Apr 28, 2018 6:08 am

Rick,

Maybe the solution is to use just the VALID of the dialog only
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests