I am using C++ Builder 13.
I have a frame with 2 TPlannerDatePicker components. The dfm is attached. The frame is used in multiple windows. The app compiles fine.
At run time, though, if I attempt to create a window that uses the frame, I get the error
Project app raised exception class EReadError with message 'Ancestor for 'cal10_' not found'.
I’ve also attached the dfm of a window that throws that error.
Any idea as to how to correct the problem?
Thanks.
frameDateRange.dfm (18.8 KB)
mnPartsLabourByMechanic.dfm (205.5 KB)
The problem is in the TPlannerDatePicker more specifically with how Delphi streams properties in combination with a TFrame.
For convenience & completeness, we give full access to the control that is used as dropdown, i.e. the TPlannerCalendar as published property. And that is causing a problem with the streaming when it is used on a frame. Sadly, so far, we have not found a solution or workaround for this limitation in combination with frames, other than create the TPlannerDatePicker instances in code at runtime from the frame.
Thanks. Now that you mention it, I seem to recall I asked about this quite some time ago. I’ve left a comment in the code so I don’t ping you again about it.
I have a new issue though. I don’t seem to be able to change the look of the calendar dropdown. For example, with this code the size of the calendar window is not changing. I tried to change in the layout in both the constructor and the resize method and neither made a difference.
I have attached an image of what the calendar looks like.
\__fastcall TDateRangeFrame::TDateRangeFrame(TComponent\* Owner)
: TFrame(Owner) {
FUpdated = NULL;
FInChange = false;
// These need to be created on the fly due to a "quirk" of Delphi.
// Don't bother Bruno about this again
FromDateEdt = new TPlannerDatePicker(this);
FromDateEdt->Parent = DRPanel;
FromDateEdt->Name = "FromDateEdt";
FromDateEdt->LabelCaption = "From";
FromDateEdt->Left = 48;
FromDateEdt->Top = 151;
ToDateEdt = new TPlannerDatePicker(this);
ToDateEdt->Parent = DRPanel;
ToDateEdt->Name = "ToDateEdt";
ToDateEdt->LabelCaption = "To";
ToDateEdt->Left = 48;
ToDateEdt->Top = 185;
}
void \__fastcall TDateRangeFrame::FrameResize(TObject \*Sender) {
StylePlanner(FromDateEdt);
StylePlanner(ToDateEdt);
}
void \__fastcall TDateRangeFrame::StylePlanner(TPlannerDatePicker\* PLANNER) {
PLANNER->Height = 28;
PLANNER->Width = 180;
PLANNER->ParentFont = false;
PLANNER->LabelPosition = lpLeftCenter;
PLANNER->LabelMargin = 4;
PLANNER->LabelFont->Name = "Segoe UI";
PLANNER->LabelFont->Size = 8;
PLANNER->LabelTransparent = true;
PLANNER->Font->Name = "Segoe UI";
PLANNER->Font->Size = 9;
PLANNER->Calendar->Width = 280;
PLANNER->Calendar->Height = 320;
PLANNER->Calendar->Font->Name = "Segoe UI";
PLANNER->Calendar->Font->Size = 8;
PLANNER->Calendar->ParentFont = false;

}
To change the dimensions of the dropdown calendar, use something like:
begin
plannerdatepicker1.BeginUpdate;
plannerdatepicker1.Calendar.Width := 400;
plannerdatepicker1.Calendar.Height := 400;
plannerdatepicker1.EndUpdate;
end;