implemented calendar events for win32 interface (bug )

git-svn-id: trunk@7512 -
This commit is contained in:
vincents 2005-08-16 21:36:49 +00:00
parent b526cdf66b
commit faef2dfd4d
3 changed files with 46 additions and 21 deletions

View File

@ -67,6 +67,7 @@ Type
function GetDate: String;
procedure SetDate(const AValue: String);
protected
procedure LMChanged(var Message: TLMessage); message LM_CHANGED;
procedure LMMonthChanged(var Message: TLMessage); message LM_MONTHCHANGED;
procedure LMYearChanged(var Message: TLMessage); message LM_YEARCHANGED;
procedure LMDayChanged(var Message: TLMessage); message LM_DAYCHANGED;
@ -270,6 +271,23 @@ begin
end;
end;
procedure TCustomCalendar.LMChanged(var Message: TLMessage);
var
NewDate: TDateTime;
OldDay, OldMonth, OldYear: word;
NewDay, NewMonth, NewYear: word;
begin
NewDate := TWSCalendarClass(WidgetSetClass).GetDateTime(Self);
if (NewDate=FDate) then exit;
DecodeDate(NewDate, NewYear, NewMonth, NewDay);
DecodeDate(FDate, OldYear, OldMonth, OldDay);
FDate:= NewDate;
if (OldYear<>NewYear) and Assigned(OnYearChanged) then OnYearChanged(self);
if (OldMonth<>NewMonth) and Assigned(OnMonthChanged) then OnMonthChanged(self);
if (OldDay<>NewDay) and Assigned(OnDayChanged) then OnDayChanged(self);
if Assigned(OnChange) then OnChange(self);
end;
procedure TCustomCalendar.LMDAYChanged(var Message: TLMessage);
begin
if Assigned(OnDayChanged) then OnDayChanged(self);

View File

@ -528,11 +528,6 @@ Begin
Assert(False, Format('Trace:WindowProc - Window Value: $%S-%d; Msg Value: %S; WParam: $%S; LParam: $%S', [IntToHex(Window, 4), Window, WM_To_String(Msg), IntToHex(WParam, 4), IntToHex(LParam, 4)]));
Case Msg Of
LM_MONTHCHANGED..LM_DAYCHANGED:
Begin
If lWinControl Is TCalendar Then
LMessage.Msg := Msg;
End;
WM_ACTIVATE:
Begin
Case Lo(WParam) Of
@ -1087,23 +1082,31 @@ Begin
End;
WM_NOTIFY:
Begin
PLMsg:=@LMNotify;
With LMNotify Do
Begin
Msg := LM_NOTIFY;
IDCtrl := WParam;
NMHdr := PNMHDR(LParam);
With NMHdr^ do
case code of
TCN_SELCHANGING:
ShowHideTabPage(HWndFrom, False);
TCN_SELCHANGE:
begin
ShowHideTabPage(HWndFrom, True);
idFrom := Windows.SendMessage(HWndFrom, TCM_GETCURSEL, 0, 0);
if PNMHdr(LParam)^.code=MCN_SELCHANGE then begin
LMessage.Msg := LM_CHANGED;
WindowInfo := GetWindowInfo(PNMHdr(LParam)^.hwndFrom);
if WindowInfo^.WinControl<>nil then
lWinControl := WindowInfo^.WinControl;
end
else begin
PLMsg:=@LMNotify;
With LMNotify Do
Begin
Msg := LM_NOTIFY;
IDCtrl := WParam;
NMHdr := PNMHDR(LParam);
With NMHdr^ do
case code of
TCN_SELCHANGING:
ShowHideTabPage(HWndFrom, False);
TCN_SELCHANGE:
begin
ShowHideTabPage(HWndFrom, True);
idFrom := Windows.SendMessage(HWndFrom, TCM_GETCURSEL, 0, 0);
end;
end;
end;
End;
End;
end;
End;
WM_PAINT:
Begin

View File

@ -142,6 +142,10 @@ Const
LVS_EX_SNAPTOGRID = $00080000;
LVS_EX_SIMPLESELECT = $00100000;
// for calendar control
MCN_FIRST = (0-750); // monthcal
MCN_SELCHANGE = (MCN_FIRST + 1);
// missing listview macros
function ListView_GetHeader(hwndLV: HWND): HWND;
function ListView_GetExtendedListViewStyle(hwndLV: HWND): DWORD;