Valid firing twice

Valid firing twice

Postby Colin Haig » 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: Select all  Expand view  RUN

   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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Valid firing twice

Postby Antonio Linares » Sat Nov 01, 2014 5:56 am

Colin,

Please replace:

oDlg:aControls[2]:SetFocus()

with

oDlg:oJump := aControls[2]
regards, saludos

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

Re: Valid firing twice

Postby Colin Haig » 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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Valid firing twice

Postby Antonio Linares » Sun Nov 02, 2014 6:55 am

Colin,

My mistake. Please try this:

oInvc:invtot:oJump := oDlg:aControls[2]
regards, saludos

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

Re: Valid firing twice

Postby Colin Haig » Mon Nov 03, 2014 8: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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Valid firing twice

Postby Antonio Linares » Mon Nov 03, 2014 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Marc Venken, nageswaragunupudi and 57 guests