Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:21 pm
by Torrie Moore >> Thu, 20 Jan 2000 21:04:30 GMT
Jens.
We have a couple of tab sheets that we dynamically create controls on. The following code example creates a frame and a button.
In terms of the controls not appearing perhaps you need to call the refresh method on parent control. We have also put event code on the buttons but this gets complicated as you need to ensure that the event method exisits on the form that the control is placed on.
Hope this helps
Torrie Moore
Concept Engineering
windowCreated(cntrl : Control input; persistCntrl : Control) updating;
vars
begin
create gbFrame transient;
gbFrame.parent := self;
gbFrame.name := self.name & 'gbFrame';
gbFrame.caption := $Str_Notes;
gbFrame.backColor := CntrlBackColor;
self.form.addControl(gbFrame);
gbFrame.tabIndex := self.tabIndex + 1;
create bnAdd transient;
bnAdd.parent := gbFrame;
bnAdd.name := self.name & "bnAdd";
bnAdd.caption := $Str_bnNew;
bnAdd.enabled := true;
bnAdd.centreCaption := true;
self.form.addControl(bnAdd);
bnAdd.tabIndex := self.tabIndex + 2;
// Should be converting app.formMargin etc to dialog units!
gbFrame.top := app.formMargin;
gbFrame.left := app.formMargin;
gbFrame.width := self.clientWidth - 2*app.formMargin;
gbFrame.height := self.clientHeight - 2*app.formMargin;
bnAdd.top := gbFrame.clientHeight - app.formMargin - bnAdd.height;
bnAdd.left := app.formMargin;
self.refresh;
inheritMethod(cntrl,persistCntrl);
end;