FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Valid firing twice
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Valid firing twice
Posted: Sat Nov 01, 2014 12:43 AM
Hi All

I have moved to harbour from xharbour but have found a problem with a valid firing twice - the problem does not occur with xharbour.

The last valid after selecting YES in the MsgYesNo - saves the invoice but the MsgYesNo re appears

Code (fw): Select all Collapse
   REDEFINE GET oInvc:subtotal ID EditSubTtl      of oDlg UPDATE   picture '999999.99' COLOR GETCOLOR   valid(lfSetTotal(oInvc,nGstRate,oDlg),TRUE)
   REDEFINE GET oInvc:invgst ID EditGST           of oDlg UPDATE   picture '999999.99' COLOR GETCOLOR   valid(lfSetTotal(oInvc,nGstRate,oDlg),TRUE)
   REDEFINE GET oInvc:invtot ID EditTot           of oDlg UPDATE   picture '999999.99' COLOR GETCOLOR ;
            valid(if(lQuoted,if(oInvc:subtotal == 0,(oInvc:subtotal := oInvc:invtot - oInvc:invtot/nDivisor,oInvc:invgst := oInvc:invtot/nDivisor,oDlg:Update()),),),;
                  if(MsgYesNo('Save Invoice'),(SaveRec(oInvc,oDlg,oCode,oTmsht,oEmpRate,oEmp,oEmpCost,oJbStck,oSundry,oJb,oPoitms,lSuper,cPath),;
                  oBtn3:Enable(),oBtn4:Enable(),oBtn5:Enable(),oBtn6:Enable(),lNew := FALSE,oJbNo:Disable(),oDlg:aControls[2]:SetFocus()),),TRUE)  // this valid fires twice
   
   REDEFINE GET oInvc:invnotes  MEMO ID EditDet   of oDlg UPDATE COLOR GETCOLOR


Cheers

Colin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Valid firing twice
Posted: Sat Nov 01, 2014 05:56 AM

Colin,

Please replace:

oDlg:aControls[2]:SetFocus()

with

oDlg:oJump := aControls[2]

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: Valid firing twice
Posted: Sat Nov 01, 2014 11:40 PM

Hi Antonio

I tried that but got the following error

ime from start: 0 hours 0 mins 16 secs
Error occurred at: 02/11/2014, 07:36:08
Error description: Error BASE/1003 Variable does not exist: ACONTROLS

Stack Calls

Called from: input6.prg => (b)INPUT6( 372 )
Called from: .\source\classes\TGET.PRG => TGET:LVALID( 1203 )
Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 1138 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1708 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 588 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3236 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 829 )
Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 1117 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1733 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 588 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3236 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1003 )
Called from: main.prg => MAIN( 177 )

So I tried oDlg:oJump := oDlg:aControls[2] ( I thought aControls was a property of the dialog)

but I still go an error

ime from start: 0 hours 0 mins 16 secs
Error occurred at: 02/11/2014, 07:39:44
Error description: Error BASE/1005 Message not found: TDIALOG:_OJUMP
Args:
[ 1] = O TDIALOG

Stack Calls

Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TDIALOG:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TDIALOG:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TDIALOG:_OJUMP( 0 )
Called from: input6.prg => (b)INPUT6( 372 )
Called from: .\source\classes\TGET.PRG => TGET:LVALID( 1203 )
Called from: .\source\classes\CONTROL.PRG => TGET:FWLOSTFOCUS( 1138 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1708 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 588 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3236 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR( 829 )
Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR( 1117 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1733 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 588 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3236 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1003 )
Called from: main.prg => MAIN( 177 )

Cheers

Colin

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Valid firing twice
Posted: Sun Nov 02, 2014 06:55 AM

Colin,

My mistake. Please try this:

oInvc:invtot:oJump := oDlg:aControls[2]

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: Valid firing twice
Posted: Mon Nov 03, 2014 08:20 AM

Thanks Antonio

I tried setting focus to a button on the buttonbar and this seemed to fix the issue - I will try the code you suggested.

Cheers

Colin

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Valid firing twice
Posted: Mon Nov 03, 2014 08:40 AM

Colin,

The VALID code execution is related to the lost of focus sequence, thats why we have to be carefull not to interfere in the process.

Using oJump we wait until the loosing/ganning focus secuence is complete.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion