- This topic has 2 replies, 2 voices, and was last updated 10 years, 2 months ago by Support.
-
AuthorPosts
-
September 2, 2014 at 2:51 am #36283MarvParticipant
I'm writing an app to help me at work.
In the app I need to create a TsNotebook with X number of pages in runtime.
Each page created needs various header labels, edits, checkboxes, database controls (TsLabelFX, TsEdits, TsDBEdits, TsImage, etc..) dynamically created and placed on each appropriate page.
To keep things simple, each page is labeled 'Page' with the appropriate page number appended at the end.
Whatever control that needs created is iterated through a loop for the appropriate page, i.e on each new page create the appropriate label or control.
But the logic of the procedures doesn't seem to work as expected?
When the app is ran the procedure executes fine, just that whatever control doesn't show up on any of the pages.
Plus I get no exception nor runtime error of any kind
As an example, here is a snippet of the label creation procedure
Code:procedure MakeLabel(PageNo, ElementNumb, Left_pos, Top_pos: Integer; CaptionString: string);
var
NewLabel: TsLabelFX;
begin
NewLabel := TsLabelFX.Create(Form1);with NewLabel do
begin
Parent := NewWOWizPages.Pages.Objects[PageNo] as TWinControl;
Caption := CaptionString;
Left := Left_pos;
Top := Top_pos;
AutoSize := true;
Height := 20;
….
….
end;
end;Label data is taken from an array of strings constant
PageNo is the notebook page number, ElementNumb is for formatting purposes (not relevant), the rest is self explanatory.
The Parent of the notebook is a TsPanel, the notebook/pages itself is created ahead of time, then these procedures begin to populate the pages.
I demoed the code without a tsnotebook, to place controls/labels on a panel, and it works fine.
so anybody got any ideas why its not working for pages?
September 3, 2014 at 6:26 am #52381MarvParticipantWell I got it working now.
But oddly in my case TsNotebook needs to pre-exist? I'm sure I'm missing something. Not sure what.
Unless I'm doing something wrong in the dynamic creation process for a notebook control??
All labels show up on the appropriate page, but I had to leave a blank notebook control on the panel.
I scrapped the dynamic creation of the notebook and just added new pages and controls to every page.
Once I did that everything seemd to work fine. Weird.
September 7, 2014 at 11:07 am #52425SupportKeymasterHi
Can you show a demo? I will play with it. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.