Вниз
Скачать: CL | DM;

создание компонентов на этапе выполнения   Найти похожие ветки 

 
Nick-From ©   (2003-12-09 23:59) [0]

Нужно чтобы создалась, скажем, форма с кнопкой на ней:

T_MyObj = class
private
F_form: TForm;
F_button: TSpeedButton;

делаем форму:

function T_MyObj.BuildForm(var aF_FormOwner: TForm): boolean;
begin
Result := true;
Try
Self.F_form := TForm.Create(aF_fmLogonOwner);
Self.F_form.Width := 300;
Self.F_form.Height := 170;
Self.F_form.BorderIcons := [biSystemMenu];
Self.F_form.BorderStyle := bsSingle;
Self.F_form.Position := poDesktopCenter;
Except
Result := false;
End
end;

а теперь кнопку на ней:

function T_MyObj.BuildButton: boolean;
begin
Result := true;
Try
Self.F_button := TSpeedButton.Create(Self.F_form);
Self.F_button.Left := 35;
Self.F_button.Top := 35;
Self.F_button.Width := 120;
Self.F_button.Height := 22;
Self.F_button.TabOrder := 0;
Except
Result := false;
End
end;

Ну а потом все сразу:

function T_MyObj.BuildLogOnAll(var aF_FormOwner: TForm): boolean;
begin
Result := true;
Try
Self.BuildForm(aF_fmLogonOwner);
Self.BuildButton;
Self.F_form.ShowModal;
Except
Result := false;
End
end;

Форма есть, а кнопки на ней нет - что не так я делаю?


 
Zacho ©   (2003-12-10 00:14) [1]

Насколько понял, тебе надо добавить Self.F_button.Parent:=Self.F_form;
Кстати, можно и так: F_button.Parent:=F_form;


 
easy ©   (2003-12-10 00:15) [2]

http://delphi.vitpc.com/helloworld/runtime_comp.htm


 
lak   (2003-12-10 00:53) [3]

Удалено модератором
Примечание: Offtopic



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.011 c
14-99769
Knight
2003-12-05 23:11
2003.12.30
Какой максимальный объём данных...


14-99745
Davron
2003-12-07 16:07
2003.12.30
ColorDlg.dcu


4-99812
DillerXX
2003-11-02 18:32
2003.12.30
Кнопка


3-99493
fantomas
2003-12-04 12:16
2003.12.30
InterBase


1-99596
Эли
2003-12-17 13:48
2003.12.30
drag&




   Наверх