I have had a quick look at the Guide and the Demo.
This form is grafted on a panel of the mainform.
I was expecting to see something, but the planner collapses to 0 height. Once I can see something, then I can experiment with the properties. The only thing I have changed in the dfm is to align to Client. What am I missing?
pas
unit Ops.Planner.Manage;
interface
uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCPlanner,
VCL.TMSFNCPlannerItemEditorRecurrency, VCL.TMSFNCCustomComponent,
VCL.TMSFNCPlannerDatabaseAdapter, Vcl.Controls, VCL.TMSFNCCustomControl,
VCL.TMSFNCPlannerBase, VCL.TMSFNCPlannerData,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB,
Remote.Data,
Ops.Main;
type
Tfrm_Planner = class(TWebForm)
pln_: TTMSFNCPlanner;
db_ : TTMSFNCPlannerDatabaseAdapter;
edt_: TTMSFNCPlannerItemEditorRecurrency;
src_: TWebDataSource;
xds_: TXDataWebDataSet;
procedure pln_Click(Sender: TObject);
private
procedure Initialise;
procedure Activate;
procedure Initialise_Data_Binding;
procedure Initialise_Timeline;
public
class procedure Display;
end;
implementation
{$R *.dfm}
uses
PBS.WEB.Common,
Ops.Planner.Types;
{Tfrm_Planner }
class procedure Tfrm_Planner.Display;
procedure After_Create (AForm : TObject);
begin
Tfrm_Planner(AForm).Initialise;
end;
begin
frm_Ops_Main.Show_Form (Tfrm_Planner, @After_Create);
end;
procedure Tfrm_Planner.Initialise;
begin
pln_.BeginUpdate;
Initialise_Timeline;
pln_.EndUpdate;
Initialise_Data_Binding;
Activate;
end;
procedure Tfrm_Planner.Activate;
begin
pln_.Enabled := True;
db_.LoadItems;
pln_.Visible := True;
end;
procedure Tfrm_Planner.Initialise_Data_Binding;
begin
with db_
do begin
Item.DataSource := src_;
Item.DBKey := fld_Ref;
Item.Title := fld_Subject;
Item.Text := fld_Summary;
Item.StartTime := DateToStr (Now);
Item.EndTime := DateToStr (Now+1);
end;
end;
procedure Tfrm_Planner.Initialise_Timeline;
begin
with pln_
do begin
Mode := pmMultiDay;
ModeSettings.StartTime := Now;
Positions.Count := 7;
Timeline.DisplayUnit := 15;
Timeline.DisplayUnitType := pduMinute;
Timeline.DisplayStart := 0;
Timeline.DisplayEnd := 143;
Timeline.ViewStart := Now;
end;
end;
procedure Tfrm_Planner.pln_Click(Sender: TObject);
begin
TConsole.Log ('Clicked');
end;
end.
Next problem. I have set the Formcontainer to a div with id div.planner. But at render this id gets changed to main.webpanel, so the span breaks out of the div (I guess because it cant find the id). Worse now there are two elements with the same id. I dont have any code that changes the id.
The planner form is getting grafted to main.webpanel that resides on the mainform. This id is getting assigned to the inner div.
Any ideas on how I can fix this? I have tried nested divs, rows etc. No matter what I do the span becomes a sibling of the formcontainer.
Please try to isolate this and provide a sample source project with which this can be reproduced.
Where is 'main.webpanel" coming from? Is this really the main form, do you host the form with Planner in another form, or is it a popup form, etc etc..
There are so many details that can affect what you see that without having any knowledge about what exactly you are doing, it is impossible to investigate.
You can drop ZIP files here, that makes it possible to have CSS files included and is just one click for me to download your project instead of 8 clicks.
I do not understand where you get the construct to create the form that is supposed to be loaded into an existing HTML element. The demo under Demo\Basics\FormHosting shows how this is done, i.e. Tfrm_Planner.CreateNew(Grafted_Id, ...);
When I use this construct as demonstrated in the demo, the new form sits under main.webplanel and the DIV element with ID form.planner is put under it.
You set TMSFNCPlanner.Align = alClient, in other words, you expect it to align to a DIV in which it is hosted, but this DIV has no size, hence, when the TMSFNCPlanner aligns to an element with no size, it becomes width=0, height=0, hence it is not visible.
Although this project seems to be named TMSFNCPlanner_Bug, I can not see a bug in our control, only incorrect approaches to create a new form and host a Planner in it.