Blog Options
Archive
<< September 2025 >>-
Wednesday 17
- TMS at the 30 Years of Delphi Celebration in Sinsheim -
Thursday 11
- RAD Studio 13 Florence support for TMS components -
Wednesday 10
- Building a Scalable Gift Aid SaaS Platform with TMS Sphinx, Aurelius, XData, and WEB Core -
Tuesday 9
- Adding an existing library to Smart Setup in 20 minutes -
Friday 5
- A new chapter for TMS -
Thursday 4
- EKON29 The Developer Conference for Delphi -
Wednesday 3
- AI-powered HTML Reports with Embedded Browser Visualization -
Monday 1
- Kickstart the New Academic Year with TMS Academic for Delphi and C++ Developers
- Filter and Sort your tasks in TMS FNC Gantt Chart
- StellarDS: Introduction to Cloud Backend - Technology and Costs
Authors
- Bernard Roussely (2)
- Wagner Landgraf (93)
- Roman Yankovsky (2)
- Bart Holvoet (41)
- Aaron Decramer (55)
- Pieter Scheldeman (124)
- Nancy Lescouhier (32)
- Adrian Gallero (34)
- Bruno Fierens (443)
- Marcos Douglas B. Santos (5)
- Bernard (4)
- Bradley Velghe (33)
- Andrew Simard (86)
- Holger Flick (15)
- Gjalt Vanhouwaert (42)
- Tunde Keller (30)
- Masiha Zemarai (117)
Blog
All Blog Posts | Next Post | Previous Post
Adding weeknumbers to the VCL TDateTimePicker control calendar
Tuesday, August 18, 2009
The VCL component TMonthCalendar that is a wrapper for the Microsoft COMCTRL MonthCalendar has a WeekNumbers property with which you can control whether week numbers are displayed or not in the calendar. It also has properties ShowToday and ShowTodayCircle to control whether to display today's date in the calendar. The VCL TDateTimePicker is also a wrapper for a Microsoft COMCTRL DateTimePicker that at first sight has an identical calendar as the MonthCalendar as dropdown control. Yet, there is nowhere a property to control displaying weeknumbers and/or today's date in this calendar. With a few lines of code though, it is possible to have control over this. Implement the TDateTimePicker.OnDropDown event and add the code:procedure TForm1.DateTimePicker1DropDown(Sender: TObject); var dwstyle: dword; mch: THandle; rct: TRect; begin mch := SendMessage((Sender as TDateTimePicker).Handle, DTM_GETMONTHCAL, 0,0); dwStyle := GetWindowLong(mch, GWL_STYLE); // add this line if you want to see week numbers in the dropdown calendar dwStyle := dwStyle or MCS_WEEKNUMBERS; // add this line if you do not want to see the circle before today's date in the dropdown calendar dwStyle := dwStyle or MCS_NOTODAYCIRCLE; // add this line if you do not want to see today's date in the dropdown calendar dwStyle := dwStyle or MCS_NOTODAY; SetWindowLong(mch, GWL_STYLE, dwStyle); // adapt the size of the dropdown calendar as the default size is a bit too small SendMessage(mch, MCM_GETMINREQRECT, 0, integer(@rct)); MoveWindow(mch, 0, 0, rct.Right + 2, rct.Bottom + 2, True); end;
Bruno Fierens

This blog post has not received any comments yet.
All Blog Posts | Next Post | Previous Post