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