Jump to content

Recommended Posts

Posted

Hi Farshad,

 

I have a MainForm with only a Menue and an "empty" PageControl (without TabSheets) on it. Then I create dynamically TabSheet(s) and place dynamically created Frames on it using the following code:

 

procedure TfrmMain.OpenFrame(Sender: TObject);
var
 ts: TUniTabSheet;
 fra: TUniFrame;
begin
 ts := TUniTabSheet.Create(self);
 ts.Caption := (Sender as TMenuItem).Caption;
 ts.PageControl := PageCtrl;
 PageCtrl.ActivePage := ts;
 fra := TFrameClass((Sender as TMenuItem).Tag).Create(self); // type TFrameClass = class of TUniFrame;
 ts.Tag := Integer(fra); // call "TComponent(PageCtrl.ActivePage.Tag).Free;" when close TabSheet (ActivePage) later
 fra.Name := fra.Name + IntToStr(Integer(fra)); // to open a frame more than once
 fra.Align := alClient;
 fra.Parent := ts;
end;

 

When creating the first TabSheet this way, it is empty in WebMode until I click on the TabSheet. This is only in WebMode and only when it is the first TabSheet of the PageControl.

 

Thank you for your good work. UniGui is a very productive environment.

 

Best regards

Oliver

  • Administrators
Posted

No need for a testcase.

 

Workaround:

 

procedure TfrmMain.OpenFrame(Sender: TObject);
var
 ts: TUniTabSheet;
 fra: TUniFrame;
begin
 ts := TUniTabSheet.Create(self);
 ts.Caption := (Sender as TMenuItem).Caption;
 ts.PageControl := PageCtrl;
 PageCtrl.TabIndex:=-1;   // <-------------------------add this
 PageCtrl.ActivePage := ts;
 fra := TFrameClass((Sender as TMenuItem).Tag).Create(self); // type TFrameClass = class of TUniFrame;
 ts.Tag := Integer(fra); // call "TComponent(PageCtrl.ActivePage.Tag).Free;" when close TabSheet (ActivePage) later
 fra.Name := fra.Name + IntToStr(Integer(fra)); // to open a frame more than once
 fra.Align := alClient;
 fra.Parent := ts;
end;

 

It will be fixed in next build. Issue #1025

×
×
  • Create New...