checkbox and on change

checkbox and on change

Postby Silvio » Tue May 05, 2009 11:36 am

REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota;
ON CHANGE( aDat[11]:=ctod(dBassa1+cYEAR),oDat[11]:refresh(),aDat[12]:= ctod(dBassa4+cYEAR),oDat[12]:refresh())

this run ok when I click on checkbox

when I erase the click on this check I want it rechange the variables aDat[11] and aDat[12] with the initial parameter

How I can make it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: checkbox and on change

Postby ukoenig » Tue May 05, 2009 12:51 pm

Hello Silvio,

the modified example : Testchck.prg uses oChk:lChecked

Code: Select all  Expand view

#include "FiveWin.ch"

static oWnd

//----------------------------------------------------------------------------//

function Main()
local lValue := .f., oChk

DEFINE WINDOW oWnd TITLE "Testing CheckBox ON CHANGE clause"

@ 3, 3 CHECKBOX oChk VAR lValue PROMPT "&ClickMe" SIZE 100, 20 OF oWnd ;
ON CHANGE IIF( oChk:lChecked = .T., ;
          oChk:SetText( "Check is on" ), ;
          oChk:SetText( "Check is off" ) ) COLOR "W+/B"

ACTIVATE WINDOW oWnd

return nil
 


Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: checkbox and on change

Postby Silvio » Tue May 05, 2009 1:15 pm

danke
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: checkbox and on change

Postby Silvio » Wed May 06, 2009 9:00 am

Uwe the problem is on field date because it not refresh the second get

this not run not refresh the gets

REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota;
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=CTOD(" / / "),;
oDat[11]:refresh(),;
aDat[12]:=CTOD(" / / "),;
oDat[12]:refresh()))

--------------------------------------------------------------------------------
this run

REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota; // intera stagione
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=date(),;
oDat[11]:refresh(),;
aDat[12]:=date(),;
oDat[12]:refresh()))


But I want erase the date on the get aDat[11] and aDat[12]

I not remember but someone ask somethigs of it to erase space date ...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: checkbox and on change

Postby ukoenig » Wed May 06, 2009 12:24 pm

Hello Silvio,

Maybe something wrong with Your Date-define ( SET DATE .... ).
I tested this and it works :

Image

Code: Select all  Expand view

cYEAR := STR( YEAR( DATE() ) )
lCheck1 := .F.

// Inside my Test, I don't have SET DATE.
// If SET DATE .... is missing, American Format is used for the Vars :

dBassa1 := "10/08."    // returns => 08. of October in Get-Field
dBassa4 := "10/10."    // returns => 10. of October in Get-Field

dBassa4 := "20/10."    // returns => empty date ( error )

*Uwe the problem is on field date because it not refresh the second get
*this not run not refresh the gets

REDEFINE CHECKBOX oCheck VAR lCheck1  ID 500 OF oDlg3 ;
ON CHANGE (  IIF( oCheck:lChecked = .T., ;
                                ( aDat11 :=ctod(dBassa1+cYEAR),;
                                  aDat12 := ctod(dBassa4+cYEAR) ),;
                                ( aDat11 :=CTOD("  /  /  "), ;
                                  aDat12 :=CTOD("  /  /  ") ) ), ;
              oDat11:refresh(), oDat12:refresh() )

REDEFINE GET oDAT11 VAR aDAT11  ID 510 OF oDlg3  PICTURE "##.##.####" UPDATE
REDEFINE GET oDAT12 VAR aDAT12  ID 520 OF oDlg3  PICTURE "##.##.####" UPDATE
 


Regards
uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: checkbox and on change

Postby Silvio » Thu May 07, 2009 9:05 am

uwe
i USE
REDEFINE DTPICKER oDat[11] VAR aDat[11] ID 111 OF oPrenota UPDATE ON CHANGE (oDat[11]:Refresh(),oSay2:refresh())
REDEFINE DTPICKER oDat[12] VAR aDat[12] ID 112 OF oPrenota UPDATE ON CHANGE (oDat[12]:Refresh(),oSay2:refresh())

REDEFINE CHECKBOX oDat[13] VAR aDat[13] ID 113 OF oPrenota; // intera stagione
ON CHANGE IIF( oDat[13]:lChecked = .T., ;
(aDat[11]:=ctod(dBassa1+cYEAR),;
oDat[11]:refresh(),;
aDat[12]:= ctod(dBassa4+cYEAR),;
oDat[12]:refresh()),;
(aDat[11]:=ctod(" / / "),;
oDat[11]:refresh(),;
aDat[12]:=ctod(" / / "),;
oDat[12]:refresh()))

AND NOT RUN OK
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: checkbox and on change

Postby ukoenig » Thu May 07, 2009 2:49 pm

Silvio,

I tested with datapicker. It seems, the fields don't display empty dates.

I found another solution, to work with Your checkbox :
You need 2 extra SAY's, to display the values from the Datapicker and empty Dates from the checkbox.

Image
Image

Code: Select all  Expand view

Set Date British
Set Century on

DEFINE DIALOG oDlg RESOURCE "Main"

aVAR[1] := CTOD("10.08.2009")   // ctod(dBassa1+cYEAR)
dSay1 := CTOD("10.08.2009")      // ctod(dBassa1+cYEAR)
REDEFINE DTPicker aGet[1] VAR aVAR[1]  ID 110 UPDATE OF oDlg ;
ON CHANGE ( dSAY1 := aVAR[1], oSAY1:Refresh(), aCheck := .T., oCheck:Refresh() )

REDEFINE SAY oSay1 VAR dSAY1  ID 115 UPDATE OF oDlg
   
aVAR[2] := CTOD("08.07.2009")   // ctod(dBassa4+cYEAR)
dSay2 := CTOD("08.07.2009")      // ctod(dBassa4+cYEAR)
REDEFINE DTPicker aGet[2] VAR aVAR[2]  ID 120 UPDATE OF oDlg ;
ON CHANGE ( dSAY2 := aVAR[2], oSAY2:Refresh() )

REDEFINE SAY oSay2 VAR dSAY2  ID 125 UPDATE OF oDlg

REDEFINE CHECKBOX oCheck  VAR aCheck  ID 130 OF oDlg ;
ON CHANGE ( IIF( oCheck:lChecked = .T., ;
          ( dSAY1 := aVAR[1], ;
            dSAY2 := aVAR[2] ), ;
          ( dSAY1 :=ctod("  /  /    "), ;
            dSAY2 :=ctod("  /  /    ") ) ), ;
          oSAY1:refresh(), oSAY2:refresh() )
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: checkbox and on change

Postby Silvio » Thu May 07, 2009 4:07 pm

we why not we ask to Antonio ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: checkbox and on change

Postby ukoenig » Thu May 07, 2009 4:17 pm

Hello Silvio,

it might be the best to ask Antonio, if it is possible, to display fields with empty date.
I searched for the source of datapicker-class, but couln't find it.
In datetime.prg I found a checkbox inside the Date-Field,
maybe there is a way to use it.

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: checkbox and on change

Postby StefanHaupt » Fri May 08, 2009 10:51 am

Silvio, Uwe,

it should be possible to display an empty datefield if you add DTS_NONE to the style of DTPicker.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: checkbox and on change

Postby Silvio » Mon Jun 15, 2009 8:48 am

Uwe
the check not run the DTPICKERs not refresh()

REDEFINE DTPICKER oT:oDat[24] VAR oT:aDat[ 24] ID 128 OF oDlc ON CHANGE oT:oDat[24]//dal
REDEFINE DTPICKER oT:oDat[25] VAR oT:aDat[ 25] ID 129 OF oDlc ON CHANGE oT:oDat[25]//dal

REDEFINE CHECKBOX oT:oDat[26] VAR oT:aDat[26] ID 130 OF oDlc; // intera stagione
ON CHANGE IIF( oT:oDat[26]:lChecked = .T. , ;
(oT:aDat[ 24]:=ctod(dBassa1+cYEAR),;
oT:aDat[ 25]:=ctod(dBassa4+cYEAR),;
oT:oDat[24]:refresh(),;
oT:oDat[25]:refresh()),;
(oT:aDat[ 24]:=ctod(" / / "),;
oT:aDat[ 25]:=ctod(" / / "),;
oT:oDat[24]:refresh(),;
oT:oDat[25]:refresh()))
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: karinha, nageswaragunupudi and 57 guests