Delphi TMonthCalendar - stop auto scrolling, and what month am I on? - delphi

Drop a TMonthCalendar control onto a form. Set it to show one month. Use US English locale (Sunday as first day of week). View January 2013. Your calendar actually is showing December 30th, 2012 to February 9th, 2013 because it shows 42 days total. Set your MaxSelCount to 42 and set MultiSelect to true so you can select and number of these days.
Issue 1 - Click on December 31st, and hold the mouse down. Drag to January 1st and let go. You have two days selected. Works as expected. Clear this selection by selecting another date in January. Now select the same two days again, but this time select January 1st FIRST, and drag left in order to get December 31st highlighted. Notice how the calendar scrolls left into December? How can I stop the calendar from scrolling???
Issue 2 - In both scenarios above you had the same two dates selected, but the displayed month of the calendar was completely different. How can I tell what month is actually being displayed by the calendar?
Issue 3 - Select from January 24th to February 1st. The calendar now scrolls to February, and then cuts off the 24th, 25th, and 26th from view. Seems completely broken.
I've also tried the Jedi controls which are wrappers.

The easy one is the second one. You can simply use the MCM_GETMONTHRANGE message – or, more simply, the MonthCal_GetMonthRange 'macro' – to obtain this information.
For example (uses CommCtrl),
procedure TForm1.FormClick(Sender: TObject);
var
st: array[0..1] of TSystemTime;
begin
MonthCal_GetMonthRange(MonthCalendar1.Handle, GMR_VISIBLE, #st);
Caption := IntToStr(st[0].wMonth);
end;

Related

How to highlight months dynamically in Angular Material datepicker?

I can't find documentation for selected month for Angular Material Calendar highlight month.I want to show calendar with Month (3 months) highlighted and these month values are coming from Backend Data Respond. And when user able to change another month auto selected to 3 months.
For example, while I click on June, next two month July and August should selected as like the below image.

Jump to Current Month from Any Month in Calendar?

I am using SACalendar. I am trying to achieve jump to Today's date from any month. After Scrolling to any month I should able to move directly to Today's date.

How to create a daily calendar event using event kit?

I am having a event starting from june 1st to june 10th daily 10 am to 5 pm.After creating the event programatically it needs to add in calendar from june 1st to 10th in between 10 to 5 only.I don't want to enable the all day option.I want to use repeat daily option.And it needs to show in the dates given and time mentioned in blue colour (how event will display).
Create an instance of EKEvent for the event, and an instance of EKRecurrenceRule that describes the way the item repeats. Add the rule to the event using the -addRecurrenceRule: method from EKCalendarItem (which EKEvent inherits).
The color used to display the event is determined by the calendar, not by the event. If you must use a certain color, it's probably best to create a new calendar.

Hover-to-click on jQuery UI datePicker 'next month' and 'prev month' not working

I have a calendar which is meant to look much like the calendar in Outlook. There is a big field representing the hours in a day, and there is a date navigator. The navigator is the jQuery UI Datepicker.
I want users to be able to navigate to a new day by clicking on a date in the datepicker, but also to be able to drag appointments over the datepicker and drop them on a specific date. I have that working now.
I also want users, while they are dragging an appointment, to be able to move to next or previous month simply by hovering over the datepicker. So I've added a mouseenter and mouseleave event: one runs a setInterval function which sends a click every 1,5 seconds; the other cancels the interval function.
This is where all sorts of things go wrong. As soon as one click has been triggered, the mouseleave function no longer works: in other words, the datepicker keeps flipping over to another month every 1,5 seconds.
It seems that the datePicker interferes, or that the click event causes other things to go wrong. What can I do?
It sounds like your event listeners are been overwritten by the jQuery-UI Datepicker states. It you look at the source of the date picker, every time it changes state it re-declares its event listeners. Thats all I can say without looking at your source.
Post your source and I'll try to fix it for you. It may be necessary to monkey patch the Datepicker.

TMonthCalendar of delphi - disable the buttons

Is it possible to disable the buttons that change the date on the TMonthCalendar (VCL native)?
The calendar control is not a native Delphi control, but a wrapped Windows standard control. As such it can only be accessed using the documented interface.
In particular Spy++ reveals that it is a single window, so calling EnableWindow() to disable the navigation buttons seems impossible. What you could do is set the MaxDate and MinDate properties of the VCL control to the first and last day of the interesting month, so the month can't be changed. Unfortunately this will result in an annoying sound when the buttons are clicked.

Resources