You've already forked lazarus-ccr
RxFPC:RxMDI - new property RxMDIPanel1.WindowMenu - show MDI windows in main menu
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6792 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -19,8 +19,6 @@
|
|||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
|
||||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
@ -85,6 +83,9 @@
|
|||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
</Debugging>
|
||||||
<Options>
|
<Options>
|
||||||
<Win32>
|
<Win32>
|
||||||
<GraphicApplication Value="True"/>
|
<GraphicApplication Value="True"/>
|
||||||
|
Binary file not shown.
@ -4,12 +4,12 @@ object Form1: TForm1
|
|||||||
Top = 222
|
Top = 222
|
||||||
Width = 613
|
Width = 613
|
||||||
Caption = 'MainForm'
|
Caption = 'MainForm'
|
||||||
ClientHeight = 407
|
ClientHeight = 410
|
||||||
ClientWidth = 613
|
ClientWidth = 613
|
||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '2.1.0.0'
|
||||||
WindowState = wsMaximized
|
WindowState = wsMaximized
|
||||||
object ToolPanel1: TToolPanel
|
object ToolPanel1: TToolPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -59,7 +59,7 @@ object Form1: TForm1
|
|||||||
object RxMDITasks1: TRxMDITasks
|
object RxMDITasks1: TRxMDITasks
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 360
|
Top = 364
|
||||||
Width = 613
|
Width = 613
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
FlatButton = True
|
FlatButton = True
|
||||||
@ -67,8 +67,8 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object StatusBar1: TStatusBar
|
object StatusBar1: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 22
|
Height = 21
|
||||||
Top = 385
|
Top = 389
|
||||||
Width = 613
|
Width = 613
|
||||||
Panels = <
|
Panels = <
|
||||||
item
|
item
|
||||||
@ -81,15 +81,17 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object RxMDIPanel1: TRxMDIPanel
|
object RxMDIPanel1: TRxMDIPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 329
|
Height = 333
|
||||||
Top = 31
|
Top = 31
|
||||||
Width = 613
|
Width = 613
|
||||||
CloseButton = RxMDICloseButton1
|
CloseButton = RxMDICloseButton1
|
||||||
TaskPanel = RxMDITasks1
|
TaskPanel = RxMDITasks1
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvLowered
|
BevelOuter = bvLowered
|
||||||
|
Options = []
|
||||||
HideCloseButton = False
|
HideCloseButton = False
|
||||||
OnChangeCurrentChild = RxMDIPanel1ChangeCurrentChild
|
OnChangeCurrentChild = RxMDIPanel1ChangeCurrentChild
|
||||||
|
WindowMenu = WindowItems
|
||||||
end
|
end
|
||||||
object ActionList1: TActionList
|
object ActionList1: TActionList
|
||||||
Left = 440
|
Left = 440
|
||||||
@ -132,6 +134,11 @@ object Form1: TForm1
|
|||||||
Checked = True
|
Checked = True
|
||||||
OnExecute = optHideCloseButtonExecute
|
OnExecute = optHideCloseButtonExecute
|
||||||
end
|
end
|
||||||
|
object wndCloseAll: TAction
|
||||||
|
Category = 'Windows'
|
||||||
|
Caption = 'Close all...'
|
||||||
|
OnExecute = wndCloseAllExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object MainMenu1: TMainMenu
|
object MainMenu1: TMainMenu
|
||||||
Left = 408
|
Left = 408
|
||||||
@ -169,6 +176,12 @@ object Form1: TForm1
|
|||||||
Action = Action3
|
Action = Action3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object WindowItems: TMenuItem
|
||||||
|
Caption = 'Window'
|
||||||
|
object MenuItem13: TMenuItem
|
||||||
|
Action = wndCloseAll
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object Timer1: TTimer
|
object Timer1: TTimer
|
||||||
Interval = 500
|
Interval = 500
|
||||||
|
@ -16,6 +16,9 @@ type
|
|||||||
Action1: TAction;
|
Action1: TAction;
|
||||||
Action2: TAction;
|
Action2: TAction;
|
||||||
Action3: TAction;
|
Action3: TAction;
|
||||||
|
WindowItems: TMenuItem;
|
||||||
|
MenuItem13: TMenuItem;
|
||||||
|
wndCloseAll: TAction;
|
||||||
MenuItem11: TMenuItem;
|
MenuItem11: TMenuItem;
|
||||||
optHideCloseButton: TAction;
|
optHideCloseButton: TAction;
|
||||||
MenuItem10: TMenuItem;
|
MenuItem10: TMenuItem;
|
||||||
@ -49,6 +52,7 @@ type
|
|||||||
procedure RxMDIPanel1ChangeCurrentChild(Sender: TRxMDIPanel; AForm: TForm);
|
procedure RxMDIPanel1ChangeCurrentChild(Sender: TRxMDIPanel; AForm: TForm);
|
||||||
procedure sysCloseExecute(Sender: TObject);
|
procedure sysCloseExecute(Sender: TObject);
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
procedure wndCloseAllExecute(Sender: TObject);
|
||||||
private
|
private
|
||||||
procedure UpdateOptions;
|
procedure UpdateOptions;
|
||||||
public
|
public
|
||||||
@ -80,6 +84,11 @@ begin
|
|||||||
;
|
;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.wndCloseAllExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
RxMDIPanel1.CloseAll;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.UpdateOptions;
|
procedure TForm1.UpdateOptions;
|
||||||
begin
|
begin
|
||||||
RxMDICloseButton1.ShowInfoLabel:=optShowInfoLabel.Checked;
|
RxMDICloseButton1.ShowInfoLabel:=optShowInfoLabel.Checked;
|
||||||
|
@ -153,6 +153,10 @@ type
|
|||||||
FOnChangeCurrentChild: TRxMDIPanelChangeCurrentChild;
|
FOnChangeCurrentChild: TRxMDIPanelChangeCurrentChild;
|
||||||
FOptions: TRxMDIPanelOptions;
|
FOptions: TRxMDIPanelOptions;
|
||||||
FTaskPanel: TRxMDITasks;
|
FTaskPanel: TRxMDITasks;
|
||||||
|
FWindowMenu: TMenuItem;
|
||||||
|
FWindowMenuSeparator1: TMenuItem;
|
||||||
|
FWindowMenuSeparator2: TMenuItem;
|
||||||
|
FWindowMenuDialogBox: TMenuItem;
|
||||||
procedure SetCurrentChildWindow(AValue: TForm);
|
procedure SetCurrentChildWindow(AValue: TForm);
|
||||||
procedure navCloseButtonClick(Sender: TObject);
|
procedure navCloseButtonClick(Sender: TObject);
|
||||||
procedure SetHideCloseButton(AValue: boolean);
|
procedure SetHideCloseButton(AValue: boolean);
|
||||||
@ -163,6 +167,11 @@ type
|
|||||||
procedure ScreenEventRemoveForm(Sender: TObject; Form: TCustomForm);
|
procedure ScreenEventRemoveForm(Sender: TObject; Form: TCustomForm);
|
||||||
procedure DoOnChangeCurrentChild(AForm:TForm);
|
procedure DoOnChangeCurrentChild(AForm:TForm);
|
||||||
procedure DoKeyDownHandler(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure DoKeyDownHandler(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
procedure RefreshMDIMenu;
|
||||||
|
procedure ClearMDIMenu;
|
||||||
|
procedure ClearMDIMenuSystemItems;
|
||||||
|
procedure DoMDIMenuClick(Sender: TObject);
|
||||||
|
procedure SetWindowMenu(AValue: TMenuItem);
|
||||||
protected
|
protected
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
@ -189,6 +198,7 @@ type
|
|||||||
property Options:TRxMDIPanelOptions read FOptions write FOptions;
|
property Options:TRxMDIPanelOptions read FOptions write FOptions;
|
||||||
property HideCloseButton:boolean read FHideCloseButton write SetHideCloseButton;
|
property HideCloseButton:boolean read FHideCloseButton write SetHideCloseButton;
|
||||||
property OnChangeCurrentChild:TRxMDIPanelChangeCurrentChild read FOnChangeCurrentChild write FOnChangeCurrentChild;
|
property OnChangeCurrentChild:TRxMDIPanelChangeCurrentChild read FOnChangeCurrentChild write FOnChangeCurrentChild;
|
||||||
|
property WindowMenu: TMenuItem read FWindowMenu write SetWindowMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -409,7 +419,10 @@ begin
|
|||||||
FCloseButton := nil
|
FCloseButton := nil
|
||||||
else
|
else
|
||||||
if (AComponent = FTaskPanel) and (Operation = opRemove) then
|
if (AComponent = FTaskPanel) and (Operation = opRemove) then
|
||||||
FTaskPanel:=nil;
|
FTaskPanel:=nil
|
||||||
|
else
|
||||||
|
if (AComponent = FWindowMenuSeparator1) and (Operation = opRemove) then
|
||||||
|
FWindowMenuSeparator1:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIPanel.Loaded;
|
procedure TRxMDIPanel.Loaded;
|
||||||
@ -436,6 +449,116 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxMDIPanel.RefreshMDIMenu;
|
||||||
|
|
||||||
|
function GetNextMenuItem(var K:Integer):TMenuItem;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
while K<FWindowMenu.Count-1 do
|
||||||
|
begin
|
||||||
|
Inc(K);
|
||||||
|
Result:=FWindowMenu.Items[K];
|
||||||
|
if Result.OnClick = @DoMDIMenuClick then
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if not Assigned(FWindowMenuSeparator1) then
|
||||||
|
begin
|
||||||
|
Inc(K);
|
||||||
|
FWindowMenuSeparator1:=TMenuItem.Create(FWindowMenu.Owner);
|
||||||
|
FWindowMenu.Add(FWindowMenuSeparator1);
|
||||||
|
FWindowMenuSeparator1.Caption:='-';
|
||||||
|
end;
|
||||||
|
|
||||||
|
Inc(K);
|
||||||
|
Result:=TMenuItem.Create(FWindowMenu.Owner);
|
||||||
|
FWindowMenu.Add(Result);
|
||||||
|
Result.OnClick:=@DoMDIMenuClick;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
M: TMenuItem;
|
||||||
|
B: TRxMDIButton;
|
||||||
|
K, i, CntItem: Integer;
|
||||||
|
begin
|
||||||
|
if (not Assigned(FWindowMenu)) or (not Assigned(FTaskPanel)) then Exit;
|
||||||
|
|
||||||
|
K:=-1;
|
||||||
|
CntItem:=0;
|
||||||
|
for i:=0 to FTaskPanel.ComponentCount-1 do
|
||||||
|
begin
|
||||||
|
if (FTaskPanel.Components[i] is TRxMDIButton) then
|
||||||
|
begin
|
||||||
|
B:=TRxMDIButton(FTaskPanel.Components[i]);
|
||||||
|
M:=GetNextMenuItem(K);
|
||||||
|
M.Caption:=B.Caption;
|
||||||
|
M.Checked:=B.Down;
|
||||||
|
M.Tag:=IntPtr(B);
|
||||||
|
Inc(CntItem);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if K < FWindowMenu.Count-1 then
|
||||||
|
begin
|
||||||
|
for i:=FWindowMenu.Count-1 downto K+1 do
|
||||||
|
begin
|
||||||
|
M:=FWindowMenu.Items[i];
|
||||||
|
if M.OnClick = @DoMDIMenuClick then
|
||||||
|
M.Free;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
if CntItem = 0 then
|
||||||
|
ClearMDIMenuSystemItems;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxMDIPanel.ClearMDIMenu;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
M: TMenuItem;
|
||||||
|
begin
|
||||||
|
if not Assigned(FWindowMenu) then Exit;
|
||||||
|
for i:=FWindowMenu.Count-1 downto 0 do
|
||||||
|
begin
|
||||||
|
M:=FWindowMenu.Items[i];
|
||||||
|
if M.OnClick = @DoMDIMenuClick then
|
||||||
|
M.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
ClearMDIMenuSystemItems;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxMDIPanel.ClearMDIMenuSystemItems;
|
||||||
|
begin
|
||||||
|
if Assigned(FWindowMenuSeparator1) then
|
||||||
|
FreeAndNil(FWindowMenuSeparator1);
|
||||||
|
if Assigned(FWindowMenuSeparator2) then
|
||||||
|
FreeAndNil(FWindowMenuSeparator2);
|
||||||
|
if Assigned(FWindowMenuDialogBox) then
|
||||||
|
FreeAndNil(FWindowMenuDialogBox);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxMDIPanel.DoMDIMenuClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
B: TRxMDIButton;
|
||||||
|
begin
|
||||||
|
if Sender is TMenuItem then
|
||||||
|
begin
|
||||||
|
B:=TRxMDIButton(PtrInt(TMenuItem(Sender).Tag));
|
||||||
|
if Assigned(B) then
|
||||||
|
B.Click;
|
||||||
|
end;//
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRxMDIPanel.SetWindowMenu(AValue: TMenuItem);
|
||||||
|
begin
|
||||||
|
if FWindowMenu=AValue then Exit;
|
||||||
|
if Assigned(FWindowMenu) then
|
||||||
|
ClearMDIMenu;
|
||||||
|
FWindowMenu:=AValue;
|
||||||
|
RefreshMDIMenu;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TRxMDIPanel.Create(TheOwner: TComponent);
|
constructor TRxMDIPanel.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
@ -471,13 +594,13 @@ begin
|
|||||||
F.Parent:=Self;
|
F.Parent:=Self;
|
||||||
F.Visible:=true;
|
F.Visible:=true;
|
||||||
F.BringToFront;
|
F.BringToFront;
|
||||||
// if Assigned(Application) and Assigned(Application.MainForm) and (Application.MainForm = Owner) then
|
|
||||||
// Application.MainForm.ActiveControl:=F;
|
|
||||||
if Assigned(Owner) and (Owner is TForm) then
|
if Assigned(Owner) and (Owner is TForm) then
|
||||||
TForm(Owner).ActiveControl:=F;
|
TForm(Owner).ActiveControl:=F;
|
||||||
|
|
||||||
B:=TRxMDIButton.CreateButton(TaskPanel, F);
|
B:=TRxMDIButton.CreateButton(TaskPanel, F);
|
||||||
DoOnChangeCurrentChild(F);
|
DoOnChangeCurrentChild(F);
|
||||||
|
RefreshMDIMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIPanel.ChildWindowsCreate(var AForm; FC: TFormClass);
|
procedure TRxMDIPanel.ChildWindowsCreate(var AForm; FC: TFormClass);
|
||||||
@ -942,6 +1065,7 @@ begin
|
|||||||
Owner.RemoveComponent(Self);
|
Owner.RemoveComponent(Self);
|
||||||
FNavPanel.FMainPanel.RemoveControl(Sender as TCustomForm);
|
FNavPanel.FMainPanel.RemoveControl(Sender as TCustomForm);
|
||||||
Application.ReleaseComponent(Self);
|
Application.ReleaseComponent(Self);
|
||||||
|
FNavPanel.FMainPanel.RefreshMDIMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
|
procedure TRxMDIButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
|
||||||
@ -999,6 +1123,7 @@ begin
|
|||||||
FNavPanel.FMainPanel.DoOnChangeCurrentChild(FNavForm);
|
FNavPanel.FMainPanel.DoOnChangeCurrentChild(FNavForm);
|
||||||
end;
|
end;
|
||||||
Down:=true;
|
Down:=true;
|
||||||
|
FNavPanel.FMainPanel.RefreshMDIMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIButton.UpdateCaption;
|
procedure TRxMDIButton.UpdateCaption;
|
||||||
|
@ -6267,14 +6267,20 @@ procedure TRxDBGrid.ErrorPo(DataSet: TDataSet; E: EDatabaseError;
|
|||||||
var DataAction: TDataAction);
|
var DataAction: TDataAction);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
|
F: TRxColumnFooterItem;
|
||||||
|
R: TRxColumn;
|
||||||
begin
|
begin
|
||||||
if FFooterOptions.Active and (DatalinkActive) then
|
if FFooterOptions.Active and (DatalinkActive) then
|
||||||
for i := 0 to Columns.Count - 1 do
|
for i := 0 to Columns.Count - 1 do
|
||||||
|
begin
|
||||||
|
R:=TRxColumn(Columns[i]);
|
||||||
|
F:=TRxColumn(Columns[i]).Footer;
|
||||||
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
if not TRxColumn(Columns[i]).Footer.ErrorTestValue then
|
||||||
begin
|
begin
|
||||||
FInProcessCalc := -1;
|
FInProcessCalc := -1;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
if Assigned(F_EventOnPostError) then
|
if Assigned(F_EventOnPostError) then
|
||||||
F_EventOnPostError(DataSet, E, DataAction);
|
F_EventOnPostError(DataSet, E, DataAction);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user