diff --git a/lcl/interfaces/win32/win32def.pp b/lcl/interfaces/win32/win32def.pp index c6911e3f0b..6bf5017309 100644 --- a/lcl/interfaces/win32/win32def.pp +++ b/lcl/interfaces/win32/win32def.pp @@ -33,12 +33,6 @@ uses Windows, Classes, LCLType; const - // Used by TCalendar - MCM_FIRST = $1000; - MCM_GETCURSEL = MCM_FIRST + 1; - MCM_SETCURSEL = MCM_FIRST + 2; - MCM_GETMINREQRECT = MCM_FIRST + 9; - // it is not good to use WM_USER since many programs use it. WM_LCL_SOCK_ASYNC = WM_USER + $500; @@ -56,4 +50,4 @@ var implementation -end. \ No newline at end of file +end. diff --git a/lcl/interfaces/win32/win32wscalendar.pp b/lcl/interfaces/win32/win32wscalendar.pp index 3ded38a93d..485e6f0d87 100644 --- a/lcl/interfaces/win32/win32wscalendar.pp +++ b/lcl/interfaces/win32/win32wscalendar.pp @@ -33,9 +33,9 @@ uses // To get as little as posible circles, // uncomment only when needed for registration //////////////////////////////////////////////////// - Calendar, SysUtils, Controls, LCLType, + CommCtrl, SysUtils, Controls, LCLType, Calendar, //////////////////////////////////////////////////// - WSCalendar, WSLCLClasses, Windows, Win32Def, Win32WSControls; + WSCalendar, WSLCLClasses, WSProc, Windows, Win32WSControls; type @@ -74,10 +74,12 @@ begin pClassName := 'SysMonthCal32'; WindowTitle := StrCaption; Flags := WS_CHILD or WS_VISIBLE; + if dsShowWeekNumbers in TCustomCalendar(AWinControl).DisplaySettings then + Flags := Flags or MCS_WEEKNUMBERS; SubClassWndProc := @WindowProc; end; // create window - FinishCreateWindow(AWinControl, Params, false); + FinishCreateWindow(AWinControl, Params, False); Result := Params.Window; SetClassLong(Result, GCL_STYLE, GetClassLong(Result, GCL_STYLE) or CS_DBLCLKS); // resize to proper size @@ -114,8 +116,17 @@ begin end; class procedure TWin32WSCustomCalendar.SetDisplaySettings(const ACalendar: TCustomCalendar; const ASettings: TDisplaySettings); +var + Style: LongInt; begin - // TODO: implement me! + if not WSCheckHandleAllocated(ACalendar, 'TWin32WSCustomCalendar.SetDisplaySettings') then + Exit; + Style := GetWindowLong(ACalendar.Handle, GWL_STYLE); + if dsShowWeekNumbers in ASettings then + Style := Style or MCS_WEEKNUMBERS + else + Style := Style and not MCS_WEEKNUMBERS; + SetWindowLong(ACalendar.Handle, GWL_STYLE, Style); end; class procedure TWin32WSCustomCalendar.SetReadOnly(const ACalendar: TCustomCalendar; const AReadOnly: boolean);