METHOD HandleEvent() //VIRTUAL
.../...
//----------------------------------------------------------------------------//
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TCalendar
Do Case
case nMsg == WM_LBUTTONDOWN
return ::LButtonDown( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )
case nMsg == WM_LBUTTONUP
return ::LButtonUp( nHiWord( nLParam ), nLoWord( nLParam ), nWParam )
EndCase
return ::Super:HandleEvent( nMsg, nWParam, nLParam )
//----------------------------------------------------------------------------//
// En los Methods LBUTTONDOWN y LBUTTONUP, comentar la llamada a la function IsOverDay, que siempre devuelve falso y hay que ver por qué
// Así que, de momento, prueba asi
// LButtonUp
IF ValType( ::nRowDbl ) == "N" .and. ; //IsOverDay( ::hWnd, nRow, nCol ) .AND. ;
Abs( ::nRowDbl - nRow ) <= HEIGHTDBLCLICK .AND. Abs( ::nColDbl - nCol ) <= WIDTHDBLCLICK
// LButtonDown
IF ! ::lDblClick //.and. IsOverDay( ::hWnd, nRow, nCol )
IF ! ::lDblClick //.and. IsOverDay( ::hWnd, nRow, nCol )
::nRowDbl = nRow
::nColDbl = nCol
ENDIF
REDEFINE CALENDAR oCalendar VAR dFecha ;
ID 11 OF oDlg DBLCLICK { || ( lOk := .t., oDlg:End()) }
@ 001, 205 CALENDAR oCal VAR dDate1 OF oWnd PIXEL;
DBLCLICK ( MsgInfo( oCal:GetDate() ), MsgInfo( "primero" ), oWnd:End() ) ;
ON CHANGE oDtp2:cText := oCal:GetDate() SIZE 200, 170;
ACTION( MsgInfo( "ok" ) );
WEEKNUMBER
@ 250, 001 CALENDAR oCal2 VAR dDate3, dDate4 OF oWnd PIXEL MULTISELECT DAYSTATE;
DBLCLICK ( MsgInfo( oCal2:GetDate() ), MsgInfo( "segundo" ), oWnd:End() ) SIZE 550, 170 COLOR CLR_BLACK, CLR_HRED
#include "FiveWin.ch"
#include "calendar.ch"
function main()
local oDlg, oGet, oBtn
local dFecha := date()
DEFINE DIALOG oDlg RESOURCE "SelecFecha" TITLE "Selección de fechas"
REDEFINE GET oGet VAR dFecha ID 101 OF oDlg UPDATE
REDEFINE BUTTON oBtn ID 102 OF oDlg ;
ACTION SelecFecha( @dFecha, oGet )
ACTIVATE DIALOG oDlg CENTERED
return NIL
Function SelecFecha(dFechaPres, oGet)
local oDlg, oButton1, oButton2, oSayFecha, oCalendar
local lOk := .f.
local dFecha
local aPoint := AdjustWnd(oGet, 97*2, 88*2)
IF Empty(dFechaPres)
dFecha := Date()
ELSE
dFecha := dFechaPres
ENDIF
DEFINE DIALOG oDlg RESOURCE 'Ut_Calendar' ;
TITLE "Selección de fecha" ;
COLOR GetSysColor(18), GetSysColor(15)
oDlg:lHelpIcon = .f.
REDEFINE CALENDAR oCalendar VAR dFecha ;
ID 11 OF oDlg DBLCLICK ( lOk := .t., oDlg:End())
oCalendar:oCursor := TCursor():New(,'HAND')
ACTIVATE DIALOG oDlg ;
ON PAINT ( oDlg:Move(aPoint[1], aPoint[2],,,.t.), ;
oCalendar:SetFocus(.t.) )
if lOK
oGet:cText( oCalendar:dDate )
sysrefresh()
endif
return NIL
function AdjustWnd( oBtn, nWidth, nHeight )
local nMaxWidth, nMaxHeight
local aPoint
aPoint := { oBtn:nTop + oBtn:nHeight(), oBtn:nLeft }
clientToScreen( oBtn:oWnd:hWnd, @aPoint )
nMaxWidth := GetSysMetrics(0)
nMaxHeight := GetSysMetrics(1)
if aPoint[2] + nWidth > nMaxWidth
aPoint[2] := nMaxWidth - nWidth
endif
if aPoint[1] + nHeight > nMaxHeight
aPoint[1] := nMaxHeight - nHeight
endif
return aPoint
LANGUAGE 0, SUBLANG_NEUTRAL
selecfecha DIALOG 46, 44, 192, 113
STYLE DS_3DLOOK | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "Selec Fecha"
FONT 10, "Calibri"
{
LTEXT "Fecha", IDC_STATIC, 16, 24, 32, 9, SS_LEFT
EDITTEXT 101, 50, 22, 54, 12, ES_AUTOHSCROLL
PUSHBUTTON "...", 102, 106, 22, 14, 12
}
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN
UT_CALENDAR DIALOG 126, 49, 127, 100
STYLE DS_SETFONT | WS_POPUP | WS_SYSMENU
FONT 10, "Calibri Light"
{
CONTROL "", 11, "SysMonthCal32", 0, 0, 0, 127, 100
}
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 48 guests