harbour behaviour on DIALOG INIT

Post Reply
JoséQuintas
Posts: 74
Joined: Tue Feb 09, 2021 4:20 pm
Been thanked: 1 time

harbour behaviour on DIALOG INIT

Post by JoséQuintas »

SYSTEM ERROR
Error BASE/1004 Message not found: TDIALOG:BCODEBLOCK
Called from __ERRRT_SBASE(0)
Called from TDIALOG:ERROR(0)
Called from (b)HBOBJECT(0)
Called from TDIALOG:MSGNOTFOUND(0)
Called from TDIALOG:BCODEBLOCK(0)
Called from (b)DLGTEXTMSGCLASS_EXECUTE(118)
Called from TDIALOG:INITIATE(0)
Called from TDIALOG:HANDLEEVENT(0)
Called from DIALOGBOXINDIRECT(0)
Called from TDIALOG:ACTIVATE(0)
Called from DLGTEXTMSGCLASS:EXECUTE(118)
Called from ZE_FWTEXTMSG(9)
Called from DO(0)
Called from DOPRG(152)
First code, ok no error:

Code: Select all | Expand

PROCEDURE ze_fwTextMsg

   LOCAL oDlgMsg

   oDlgMsg := DlgTextMsgClass():New()
   oDlgMsg:bCodeBlock := { || ThisTest( oDlgMsg ) }
   oDlgMsg:Execute()
Class ok

Code: Select all | Expand

CREATE CLASS DlgTextMsgClass

   VAR xDlg
   ...
   VAR bCodeBlock
   METHOD Execute()
Method Execute() have the "problem"

Code: Select all | Expand

METHOD Execute() CLASS DlgTextMsgClass
...
   IF ::bCodeBlock == Nil
      ACTIVATE DIALOG ::xDlg CENTERED
   ELSE
      ACTIVATE DIALOG ::xDlg CENTERED ;
         ON INIT ( (Self), Eval( ::bCodeBlock ) )
   ENDIF
...
What is the problem ?
ON INIT uses Self as parameter - Self is TDIALOG
Eval( ::bCodeBlock ) uses Self, but uses TDIALOG Class and not DlgTextMsgClass
TDIALOG does not have bCodeBlock.
José M. C. Quintas Brazil
gtwvg, fivewin 25.01, hwgui, mingw 15.0 rc (32 bits)
JoséQuintas
Posts: 74
Joined: Tue Feb 09, 2021 4:20 pm
Been thanked: 1 time

Re: harbour behaviour on DIALOG INIT

Post by JoséQuintas »

May be the #translate or anything else.
I will made a test using oDlg:bInit.
José M. C. Quintas Brazil
gtwvg, fivewin 25.01, hwgui, mingw 15.0 rc (32 bits)
User avatar
Antonio Linares
Site Admin
Posts: 42723
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 106 times
Contact:

Re: harbour behaviour on DIALOG INIT

Post by Antonio Linares »

Dear Jose,

Please try it this way:

Code: Select all | Expand

METHOD Execute() CLASS DlgTextMsgClass
   local oThis := Self
...
   IF ::bCodeBlock == Nil
      ACTIVATE DIALOG ::xDlg CENTERED
   ELSE
      ACTIVATE DIALOG ::xDlg CENTERED ;
         ON INIT ( (Self), Eval( oThis:bCodeBlock ) )
   ENDIF
...
regards, saludos

Antonio Linares
www.fivetechsoft.com
JoséQuintas
Posts: 74
Joined: Tue Feb 09, 2021 4:20 pm
Been thanked: 1 time

Re: harbour behaviour on DIALOG INIT

Post by JoséQuintas »

Found this way

Code: Select all | Expand

IF ::bCodeBlock != Nil
   ::xDlg:bInit := ::bCodeBlock
ENDIF   
ACTIVATE DIALOG ::xDLG CENTERED
Thanks.

Note:
Behaviour is created by #xcommand using self as parameter, to be used on codeblock.

Code: Select all | Expand

[{|Self|<uInit>}]
If change this, it may becames incompatible with existing routines.
Souce code looks clearer using bInit.
José M. C. Quintas Brazil
gtwvg, fivewin 25.01, hwgui, mingw 15.0 rc (32 bits)
Post Reply