st.wYear = 0; st.wMonth = 0; st.wDay = 0;
SendMessage( ( HWND ) _parnl( 1 ), DTM_GETSYSTEMTIME, 0, ( LPARAM ) &st );
...
METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TDatePick
local nCode := GetNMHDRCode( nPtrNMHDR )
if nCode == -759 // Date-time picker changed
SysRefresh() // here !!!
Eval( ::bSetGet, ::GetDate() )
::Change()
endif
return nil
// Date picker and Time picker samples
#include "FiveWin.ch"
#include "dtpicker.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, aGet[5], aVAR[5], aSAY[5]
Set Date British
DEFINE DIALOG oDlg RESOURCE "Main"
aVAR[1] := Date()
REDEFINE DTPicker aGet[1] VAR aVAR[1] ID 120 UPDATE OF oDlg
REDEFINE SAY aSAY[1] ID 130 UPDATE OF oDlg
aVAR[2] := Date()
REDEFINE DTPicker aGet[2] VAR aVAR[2] ID 121 UPDATE OF oDlg
REDEFINE SAY aSAY[2] ID 131 UPDATE OF oDlg
aVAR[3] := ctod('')
REDEFINE DTPicker aGet[3] VAR aVAR[3] ID 122 UPDATE OF oDlg
REDEFINE SAY aSAY[3] ID 132 UPDATE OF oDlg
aVAR[4] := Hora()
REDEFINE TMPicker aGet[4] VAR aVAR[4] ID 123 UPDATE OF oDlg
REDEFINE SAY aSAY[4] ID 133 UPDATE OF oDlg
aVAR[5] := ''
REDEFINE TMPicker aGet[5] VAR aVAR[5] ID 124 UPDATE OF oDlg
REDEFINE SAY aSAY[5] ID 134 UPDATE OF oDlg
REDEFINE BUTTON ID IDOK OF oDlg ACTION ps_Show(aGet, aSAY)
REDEFINE BUTTON ID 4 OF oDlg ACTION ps_Clean(aSAY)
REDEFINE BUTTON ID IDCANCEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return nil
static proc ps_Show(aGet, aSAY)
local i, xValor
for i:= 1 to len(aGet)
xValor := Eval(aGet[i]:bSetGet)
xValor := if( Empty(xValor), 'EMPTY', xValor )
xValor := if( Valtype(xValor)='D', dtoc(xValor), xValor )
aSAY[i]:SetText( xValor )
next
return
static proc ps_Clean(aSAY)
local i, xValor
for i:= 1 to len(aSAY)
aSAY[i]:SetText( '' )
next
return
FUNCTION Hora()
local nAux, nMin, nHor, nSec, cMin, cHor, cSec
nSec := Seconds()
nAux := Int(nSec) / 3600
nHor := Int(nAux)
nAux := (nAux - nHor) * 60
nMin := Int(nAux)
nSec := Int( (nAux - nMin) * 60 )
cHor := Padl( alltrim(str(nHor)), 2, '0')
cMin := Padl( alltrim(str(nMin)), 2, '0')
cSec := Padl( alltrim(str(nSec)), 2, '0')
return cHor + cMin + cSec
#ifdef __HARBOUR__
HB_FUNC (GETDATEPICK) //( PARAMS ) // ( hWnd ) --> dDate
#else
CLIPPER GETDATEPIC( PARAMS )
#endif
METHOD SetDate( dDate, lEmpty ) INLINE IIF (Empty(dDate),(lEmpty :=.t., dDate:=Date()), ),;
SetDatePick( ::hWnd, Year( dDate ),;
Month( dDate ), Day( dDate ),;
If( lEmpty != nil .and. lEmpty, 1, 0 ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 75 guests