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

MDI приложение   Найти похожие ветки 

 
Iconka ©   (2004-09-07 16:25) [0]

Приветсвую всех!
Как эффективней можно реализовать переключение между дочерними окнами в MDI приложении. Напрмер как это реализованно в Opere,IBExperte или PL/SQL Developere (строка кнопок с заголовками окон)


 
Defunct ©   (2004-09-07 16:29) [1]

TToolBar


 
Mim1 ©   (2004-09-07 17:59) [2]

Вынесите следующий код в отдельный модуль и при создании mdi child окон заменяте предка на TCkgMdiChild;


 TCkgMdiChild = class(TForm)
 protected
   FToolButton:TToolButton;
   procedure TextChanged; override;
   procedure Activate; override;
   procedure Deactivate; override;
 private
 public
   constructor Create(AOwner: TComponent); override;
   destructor Destroy; override;
   procedure AfterConstruction; override;
   property ToolButton:TToolButton read FToolButton;
 end;

procedure TCkgMdiChild.Activate;
begin
 inherited;
 if (ActiveControl = nil) and (FFocusAccepter <> nil) then
   try
     ActiveControl := FFocusAccepter;
   except
   end;  
 if FToolButton<> nil then FToolButton.Down := true;
end;

procedure TCkgMdiChild.AfterConstruction;
begin
 inherited;
 FToolButton.Enabled := true;

 if FFocusAccepter=nil then
   begin
     FFocusAccepter := TButton.Create(self);
     FFocusAccepter.Parent := self;
     FFocusAccepter.Left := - FFocusAccepter.Width;
     FFocusAccepter.Top := - FFocusAccepter.Height;
   end;
 FLoading := False;
end;

constructor TCkgMdiChild.Create(AOwner: TComponent);
begin
 inherited;
 FormStyle := fsMDIChild;

 if Application.MainForm is TWndMain then
   begin
     FToolButton := TToolButton.Create(nil);
     with FToolButton do
       begin
         OnClick := ToolButtonClick;
         Parent := TWndMain(Application.MainForm).AppWndBar;
         Caption := "Loading ...";
         AutoSize := true;
         Enabled := false;
       end;
   end;
end;

procedure TCkgMdiChild.Deactivate;
begin
 inherited;
 if FToolButton<> nil then FToolButton.Down := false;
end;

destructor TCkgMdiChild.Destroy;
begin
 FreeAndNil(FToolButton);
 inherited;
end;

procedure TCkgMdiChild.DoClose(var Action: TCloseAction);
begin
 action := caFree;
 inherited;
end;

procedure TCkgMdiChild.ToolButtonClick(Sender: TObject);
begin
 следующий код прийдется переписать для VCL
{  if QWidget_isVisible(Handle) then
   begin
     if (Application.MainForm as tform).ActiveMDIChild = self then
       begin
         QWidget_clearFocus(Handle);
         QWidget_hide(Handle);
       end
     else
       begin
         QWidget_clearFocus(Handle);
         if Visible and Enabled then SetFocus;
       end;
   end
 else
   begin
     QWidget_clearFocus(Handle);
     QWidget_show(Handle);
     if Visible and Enabled then SetFocus;
   end;}
end;



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

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



Память: 0.45 MB
Время: 0.036 c
6-1089805731
RagE
2004-07-14 15:48
2004.09.19
Передача типа рекорд с помощью TCLientSocket/TServerSocket


14-1093380584
Sanek_metaller
2004-08-25 00:49
2004.09.19
WarCraft на Battle.net


6-1089736761
Vladimir_v
2004-07-13 20:39
2004.09.19
Увеличение Headera письма?


14-1094050344
}|{yk
2004-09-01 18:52
2004.09.19
Помогите перевести


6-1089078139
Алекс А
2004-07-06 05:42
2004.09.19
Как обновить свойства обозревателя ?




   Наверх