Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.09.19;
Скачать: [xml.tar.bz2];

Вниз

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 вся ветка

Форум: "Основная";
Текущий архив: 2004.09.19;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.254 c
3-1093088270
Sirruf
2004-08-21 15:37
2004.09.19
SQL в Access


14-1094032850
megabyte
2004-09-01 14:00
2004.09.19
Neverending story


10-1039631715
frodo
2002-12-11 21:35
2004.09.19
В статье Создание CORBA-сервера для досту к данным &#xA0;Delphi4


1-1093962894
Synochka
2004-08-31 18:34
2004.09.19
ListBox, CheckListBox и Windows XP


14-1092995027
Kerk
2004-08-20 13:43
2004.09.19
"Ночной дозор" купили американцы





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский