Can not disable GET when using WHEN clause

Can not disable GET when using WHEN clause

Postby Patrick Mast » Sat Aug 16, 2008 10:05 am

Hello,

Is this a bug or a feature? ;-)

You can not disable any control when you use a WHEN clause. For example:

Code: Select all  Expand view  RUN
#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.
   
   oGet2:Disable()

   @ 3, 7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED

RETURN NIL


Is this a feature or a bug?

Patrick
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: Can not disable GET when using WHEN clause

Postby MGA » Sat Aug 16, 2008 11:08 am

Patrick,

Patrick Mast wrote:Hello,

Is this a bug or a feature? ;-)

You can not disable any control when you use a WHEN clause. For example:

Code: Select all  Expand view  RUN
#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 "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 3,16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   ACTIVATE DIALOG oDlg CENTERED ON INIT(oGet2:Disable())

RETURN NIL


Is this a feature or a bug?

Patrick
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Can not disable GET when using WHEN clause

Postby Patrick Mast » Sat Aug 16, 2008 12:07 pm

Hey SGS,

Thanks for your sample. But I actualy want to do this:

Code: Select all  Expand view  RUN
#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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: Can not disable GET when using WHEN clause

Postby demont frank » Sat Aug 16, 2008 2:13 pm

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  RUN
#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  RUN
#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
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Re: Can not disable GET when using WHEN clause

Postby demont frank » Sat Aug 16, 2008 2:13 pm

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  RUN
#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  RUN
#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
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby Antonio Linares » Sat Aug 16, 2008 7:10 pm

Patrick,

Try it this way:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

FUNCTION Main()

   LOCAL oDlg, oGet1, oGet2, lStatus := .T.
   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 lStatus
   
   @ 3, 7 BUTTON "Disable" SIZE 30, 12 OF oDlg ACTION ( lStatus := .F., oDlg:AEvalWhen() )
   @ 3,16 BUTTON "Enable"  SIZE 30, 12 OF oDlg ACTION ( lStatus := .T., oDlg:AEvalWhen() )

   ACTIVATE DIALOG oDlg CENTERED

RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42111
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 66 guests