Patrick
It is normal. I placed a tracelog in the when clausule :
@ 2, 6 GET oGet2 VAR cVar2 OF oDlg SIZE 60, 10 WHEN (tracelog(),.T.)
with as result :
[testfw.prg->(b)MAIN] (14) Called from:
WINDOW.PRG->TDIALOG:AEVALWHEN(0)
DIALOG.PRG->TDIALOG:INITIATE(0)
DIALOG.PRG->TDIALOG:HANDLEEVENT(0)
->DIALOGBOXINDIRECT(0)
DIALOG.PRG->TDIALOG:ACTIVATE(0)
testfw.prg->MAIN(19)
[testfw.prg->(b)MAIN] (14) Called from:
WINDOW.PRG->TDIALOG:AEVALWHEN(0)
CONTROL.PRG->TGET:FORWHEN(0)
CONTROL.PRG->TGET:FWLOSTFOCUS(0)
CONTROL.PRG->TCONTROL:HANDLEEVENT(0)
TGET.PRG->TGET:HANDLEEVENT(0)
WINDOW.PRG->_FWH(0)
->DIALOGBOXINDIRECT(0)
DIALOG.PRG->TDIALOG:ACTIVATE(0)
testfw.prg->MAIN(19)
[testfw.prg->(b)MAIN] (14) Called from:
WINDOW.PRG->TDIALOG:AEVALWHEN(0)
CONTROL.PRG->(b)TCONTROL:TCONTROL(0)
->TCONTROL:CLICK(0)
BUTTON.PRG->TBUTTON:CLICK(0)
CONTROL.PRG->TBUTTON:HANDLEEVENT(0)
WINDOW.PRG->_FWH(0)
->SENDMESSAGE(0)
DIALOG.PRG->TDIALOG:COMMAND(0)
->TWINDOW:HANDLEEVENT(0)
DIALOG.PRG->TDIALOG:HANDLEEVENT(0)
->DIALOGBOXINDIRECT(0)
DIALOG.PRG->TDIALOG:ACTIVATE(0)
testfw.prg->MAIN(19)
After the disable is executed follows a aevalwhen and is the when clausule evaluated.
The when clausule must depend from the action from the button !
Frank
- Code: Select all Expand view
#include "FiveWin.ch"
FUNCTION Main()
LOCAL oDlg, oGet1, oGet2
LOCAL cVar1:="test 1"
LOCAL cVar2:="test 2"
LOCAL lEnable := .T.
SetGetColorFocus()
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 6 GET oGet1 VAR cVar1 OF oDlg SIZE 60, 10
@ 2, 6 GET oGet2 VAR cVar2 OF oDlg SIZE 60, 10 WHEN (tracelog(),lEnable)
@ 3, 7 BUTTON "Disable" SIZE 30, 12 OF oDlg ACTION (lEnable := .F.)
@ 3,16 BUTTON "Enable" SIZE 30, 12 OF oDlg ACTION (lEnable := .T.)
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
Patrick Mast wrote:Hey SGS,
Thanks for your sample. But I
actualy want to do this:
- Code: Select all Expand view
#include "FiveWin.ch"
FUNCTION Main()
LOCAL oDlg, oGet1, oGet2
LOCAL cVar1:="test 1"
LOCAL cVar2:="test 2"
SetGetColorFocus()
DEFINE DIALOG oDlg TITLE "Test"
@ 1, 6 GET oGet1 VAR cVar1 OF oDlg SIZE 60, 10
@ 2, 6 GET oGet2 VAR cVar2 OF oDlg SIZE 60, 10 WHEN .T.
@ 3, 7 BUTTON "Disable" SIZE 30, 12 OF oDlg ACTION oGet2:Disable()
@ 3,16 BUTTON "Enable" SIZE 30, 12 OF oDlg ACTION oGet2:Enable()
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
And that does not work.
Patrick