TMonthCalendar of delphi - disable the buttons - delphi

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.

Related

Delphi TTaskDialog show/hide or start/stop marquee progress bar

I have a TTaskDialog that has an OnButtonClicked event handler, in which a lengthy process (several seconds) is performed. This works fine, but I'd like some indication to the user that things are happening while that lengthy process is chugging along. I would like to have a marquee progress bar on the dialog that is initially hidden, appears when the CommandLink is clicked, and runs while the lengthy process is performed - I'd settle for a progress bar that is visible but not enabled when the dialog is displayed and is "turned on" in the OnButtonClicked event. Just including the tfShowMarqueeProgressBar flag causes the bar to appear and be scrolling when the dialog first displays, and the ProgressBar property of the dialog doesn't have Enabled or Visible type properties to control this behavior.
There are TaskDialogs in Windows itself that do what I want, so I know it's theoretically possible, though I realize that the structure of the VCL wrapper around the native control may make it difficult or impossible using the VCL object.
Is what I want possible using the TTaskDialog VCL object?
The Windows API provides the message TDM_NAVIGATE_PAGE to change the TaskDialog at runtime. You would have to pass a TASKDIALOGCONFIG structure along with this message that defines the dialog's properties. In its dwFlags field you could specify the TDF_SHOW_PROGRESS_BAR flag to show the progress bar. But this requires a lot of work as the other fields in the TASKDIALOGCONFIG structure must match the properties that you have set for Delphi's TTaskDialog component.
Delphi creates a TASKDIALOGCONFIG structure as a local variable in the function TCustomTaskDialog.DoExecute in Dialogs.pas that is used to display the TaskDialog.

What happened to "Apply" and "Apply and Close" for styles in Delphi 10.1 Berlin?

In Delphi 10 Seattle, when you're editing a style, there are 3 buttons on the top-right of the editor window's toolbar:
Apply
Apply and Close
Cancel
However, now that I'm using Delphi 10.1 Berlin, these buttons are no longer there:
I relied on these buttons to actually apply the styles. Since Embarcadero has removed these buttons, I now am at the mercy of just closing that tab:
As you can see, this becomes annoying. I also have to count on seeing the prompt to apply the styles, so I have no sure way to apply the styles. My form(s) don't even update with the new style until I explicitly "apply" it. But, since these buttons are gone, I now am forced to close the tab in order to apply the styles. Even if I save all files, it doesn't seem to apply.
How can I forcefully apply my styles while I'm editing, without closing the style editor tab? Am I missing something? I've checked all the documentation and what's new information on these changes...
It would appear these buttons have been completely removed in Delphi 10.1 Berlin, and you're forced to close the style editor in order to apply them. However, in Delphi 10.2 Tokyo, these buttons are back.
So the only thing you can do is close that tab every time you want to apply your styles, until you move up to Delphi 10.2 Tokyo.

Scrolling like Google Chrome with a click of the mouse wheel button

In Google Chrome when you click the mouse wheel button you get this cursor:
And then you are able to scroll to all possible directions, when you move around with your mouse...
IE also has this, but only moves up and down:
Is there any component for Delphi that can do this? (for a TScrollBox for example)
TMemo, for example, can do that for you, provided you set its ScrollBars property to something else than ssNone. It will even adjust according to which scroll bars are enabled. Problem with TScrollBar component is that on its own it doesn't have any focusable parts and won't receive OnMouseWheel(/Up/Down) events, but its included windowed controls might. You could write a workaround for that on main form events, though. Check solutions at http://www.delphipages.com/forum/showthread.php?t=197309
EDIT: OnMouseWheel(/Up/Down) should be OnMouse(/Up/Down), thanks to #Sertac Akyuz for pointing this out ;)
Seems like this feature is available in RAD studio 2009 (but not in D7).
You need to use Imouse (imouse.pas unit) and the control must have ControlStyle of csPannable.
quote:
Imouse (imouse.pas unit) is a standard implementation of scrolling
with middle button (called also "mouse panning"). It's also used in
RAD Studio. Imouse functionality relays on standard window scrollbars
and sends WM_HSCROLL/WM_VSCROLL to the window to make it scroll. It
works on every window, that have a scrollbar (e.g. TListView,
TTreeView, even TForm/TFrame if AutoScroll is True and at least one
scrollbar is visible).
Oh, I've forgotten one thing. Control must have csPannable in
ControlStyle, but RichView hasn't by default. So, after adding Code:
RichViewEdit1.ControlStyle := RichViewEdit1.ControlStyle +
[csPannable];
I didn't test it though.
All that is left for me is to look into the source code (When I can get my hands on copy of D2009) and maybe impliment this with D7...

Hightlight certain days in TMonthCalendar component

I am working with a TMonthCalendar VCL component in C++Builder and I am wanting to highlight certain days in a month changing its color font or its forecolor.
I have seen this properties exists in the component but the changes are applied to all days and I need to apply only to a few days. In the other hand, I tried using bolddays function but days are not highlighted enough...
How to highlight specific days in this component?
Sorry, but the standard OS MonthCalendar control that TMonthCalendar wraps simply does not support custom fonts or colors. Using the OnGetMonthInfo and OnGetMonthBoldInfo events, and the BoldDays() method, all you can do is specify whether individual days are displayed as bold or not. If that does not suit your need, then you will have to create your own custom MonthCalendar control from scratch, or find a third-party implementation.

Customizing Windows Vista Calendar Display

I want to make a program using Delphi, to watch and wait windows vista calendar displays (the two windows that appear bottom right of the screen when you hold or click the mouse on the time in systray), and when they appeared change their contents to make my own calendar (Persian calendar). Is there any way to change the contents of calendar control (SysMonthCal32) with windows messages?
Sample:
Finally I did it. The program must watch for creation of calendar window and then place its own calendar on it using SetParent API function.You can see the result app in http://www.dihav.com/pghcal/.

Resources