FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour checkbox and on change
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
checkbox and on change
Posted: 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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: checkbox and on change
Posted: Tue May 05, 2009 12:51 PM
Hello Silvio,

the modified example : Testchck.prg uses oChk:lChecked

Code (fw): Select all Collapse
#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 :-)
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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: checkbox and on change
Posted: Tue May 05, 2009 01:15 PM

danke

Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: checkbox and on change
Posted: Wed May 06, 2009 09: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: checkbox and on change
Posted: Wed May 06, 2009 12:24 PM
Hello Silvio,

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



Code (fw): Select all Collapse
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 :-)
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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: checkbox and on change
Posted: Thu May 07, 2009 09: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: checkbox and on change
Posted: Thu May 07, 2009 02: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.




Code (fw): Select all Collapse
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 :-)
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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: checkbox and on change
Posted: Thu May 07, 2009 04:07 PM

we why not we ask to Antonio ?

Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: checkbox and on change
Posted: Thu May 07, 2009 04: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 :-)
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.
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: checkbox and on change
Posted: 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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: checkbox and on change
Posted: Mon Jun 15, 2009 08: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

Continue the discussion