Blog Options
Archive
<< April 2024 >>-
Wednesday 17
- New free component for sophisticated file uploads with TMS WEB Core -
Tuesday 16
- Closing the gap with TMS FNC UI Pack new additions -
Thursday 11
- Unveiling the Latest Enhancements in TMS VCL UI Pack -
Friday 5
- TMS components and Delphi and C++Builder 12.1 -
Wednesday 3
- Customizing the login page of your application using TMS Sphinx
- A Python library for using StellarDS.io effortlessly
- Introducing: How it Works with Holger - Building a Pexels gallery app with TMS WEB Core video series
- TMS FNC Cloud Pack with StellarDS.io backend: unparalleled productivity in VCL & FMX
Authors
- Bernard Roussely (1)
- Wagner Landgraf (82)
- Roman Yankovsky (2)
- Bart Holvoet (27)
- Aaron Decramer (17)
- Pieter Scheldeman (99)
- Nancy Lescouhier (32)
- Adrian Gallero (33)
- Bruno Fierens (403)
- Marcos Douglas B. Santos (5)
- Wagner R. Landgraf (1)
- Bradley Velghe (16)
- Bernard (2)
- Andrew Simard (86)
- Holger Flick (15)
- Gjalt Vanhouwaert (30)
- Tunde Keller (22)
- Masiha Zemarai (119)
Blog
All Blog Posts | Next Post | Previous PostAdding weeknumbers to the VCL TDateTimePicker control calendar
Bookmarks: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
Bookmarks:
This blog post has not received any comments yet.
All Blog Posts | Next Post | Previous Post