Lazarus
Installation => General => Topic started by: andrejsilva on August 07, 2009, 02:21:36 pm
-
I am trying to work using tabs, the code following this operation and creating the flaps, but I am having problems with the event OnExit components that flaps when the event is not triggered, the event OnEnter works normally.
These are the codes used to create the tabs using TPageControl.
procedure TfrmPrincipal.CriarAba(clsForm: TFormClass; Index: Integer);
var
TabSheet: TTabSheet;
Form: TForm;
begin
TabSheet := TTabSheet.Create(Self);
Form := clsForm.Create(TabSheet);
if AbaExiste(Form.Caption) then
Exit;
with TabSheet do
begin
PageControl := PageControl1;
Caption := Form.Caption;
ImageIndex := Index;
end;
with Form do
begin
Align := alClient;
BorderStyle := bsNone;
Parent := TabSheet;
Show;
end;
PageControl1.ActivePage := TabSheet;
end;
function TfrmPrincipal.AbaExiste(NomeAba: string): Boolean;
var
i: Integer;
Aba: TTabSheet;
begin
Result := False;
for i := 0 to PageControl1.PageCount - 1 do
begin
if PageControl1.Pages[i].Caption = NomeAba then
begin
Aba := PageControl1.Pages[i];
PageControl1.ActivePage := Aba;
Result := True;
break;
end;
end;
end;
procedure TfrmPrincipal.FecharAba(NomeAba: string);
var
i: integer;
Aba: TTabSheet;
begin
for i := 0 to PageControl1.PageCount - 1 do
begin
if PageControl1.Pages[i].Caption = NomeAba then
begin
Aba := PageControl1.Pages[i];
Aba.Destroy;
PageControl1.ActivePageIndex := 0;
break;
end;
end;
end;
8)
-
with Form do
begin
Align := alClient;
BorderStyle := bsNone;
Parent := TabSheet;
Show;
end;
On win32
ParentWindow := TabSheet.Handle;