Determine whether the date or flip button is in monthcalander!

Source: Internet
Author: User

Uses commctrl;

VaR oldwindowproc: twndmethod;

Procedure tform1.mywindowproc (var msg: tmessage );
Begin
If msg. MSG = cn_notify then
Begin
Case twmnotify (MSG). nmhdr. Code
Mcn_getdaystate: memo1.lines. Add ('mcn _ getdaystate'); // click the page
Mcn_select, mcn_selchange: memo1.lines. Add ('mcn _ select, mcn_selchang'); // select a date
End;
End;

Oldwindowproc (MSG );
End;

Procedure tform1.formcreate (Sender: tobject );
Begin
Oldwindowproc: = monthcalendar1.windowproc;
Monthcalendar1.windowproc: = mywindowproc;
End;

549 of the questions. After reading the answer, I checked the VCL source code. It should be okay! However, clicking "click" and "Press" on the page will also trigger messages in the selected date. On the contrary, no!

At the same time, you can see one:

Released a solution for tdatetimepicker to modify the date and time at the same time

Type
Tcdatetimepicker = Class (tdatetimepicker)
Private
Procedure cnnotify (VAR message: twmnotify); message cn_notify;
End;

Function isblankpolicime (const ST: tsystemtime): Boolean;
Type
Tfast = array [0 .. 3] of DWORD;
Begin
Result: = (tfast (ST) [0] Or tfast (ST) [1] Or tfast (ST) [2] Or tfast (ST) [3]) = 0;
End;

Procedure tcdatetimepicker. cnnotify (VAR message: twmnotify );
Begin
With message, nmhdr ^ do
Begin
Result: = 0;
If (code = dtn_datetimechange) and
(Pnmdatetimechange (nmhdr) ^. dwflags = gdt_valid) and (not droppeddown) and
(Not (showcheckbox and isblankpolicime (pnmdatetimechange (nmhdr) ^. St) then
Datetime: = systemtimetodatetime (pnmdatetimechange (nmhdr) ^. St );
End;
Inherited;
End;

Procedure tform1.button1click (Sender: tobject );
Begin
With tcdatetimepicker. Create (Self) Do
Begin
Left: = 100;
Top: = 100;
Parent: = self;
Format: = 'yyyy-mm-dd hh: mm: ss ';
Visible: = true;
End;
End;

You can directly change the value based on the upper and lower limit! However, to change it to the drop-down panel, you can also select a time option. It may be a bit easier!

BTW: kylix again said there was a new clx to be released. It was a bit delayed. Didn't it mean it stopped ?? There are also BCB and bcbx's new products, which are not clear about Borland's product positioning, or are there any problems in other words ??

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.