You've already forked lazarus-ccr
RxMDI - fix AV on CloseAll
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2897 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -37,7 +37,6 @@ type
|
|||||||
FNavForm: TForm;
|
FNavForm: TForm;
|
||||||
FActiveControl:TWinControl;
|
FActiveControl:TWinControl;
|
||||||
FNavPanel:TRxMDITasks;
|
FNavPanel:TRxMDITasks;
|
||||||
FSaveClose:TCloseEvent;
|
|
||||||
procedure SetRxMDIForm(AValue: TForm);
|
procedure SetRxMDIForm(AValue: TForm);
|
||||||
procedure DoCreateMenuItems;
|
procedure DoCreateMenuItems;
|
||||||
|
|
||||||
@@ -213,7 +212,6 @@ begin
|
|||||||
if FInfoLabel<>nil then exit;
|
if FInfoLabel<>nil then exit;
|
||||||
FInfoLabel := TBoundLabel.Create(Self);
|
FInfoLabel := TBoundLabel.Create(Self);
|
||||||
FInfoLabel.ControlStyle := FInfoLabel.ControlStyle + [csNoDesignSelectable];
|
FInfoLabel.ControlStyle := FInfoLabel.ControlStyle + [csNoDesignSelectable];
|
||||||
//FInfoLabel.FocusControl := Self;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TRxMDICloseButton.Create(AOwner: TComponent);
|
constructor TRxMDICloseButton.Create(AOwner: TComponent);
|
||||||
@@ -246,7 +244,10 @@ end;
|
|||||||
procedure TRxMDIPanel.navCloseButtonClick(Sender: TObject);
|
procedure TRxMDIPanel.navCloseButtonClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Assigned(FCurrentChildWindow) then
|
if Assigned(FCurrentChildWindow) then
|
||||||
FCurrentChildWindow.Close;
|
begin
|
||||||
|
if not (csDestroying in FCurrentChildWindow.ComponentState) then
|
||||||
|
FCurrentChildWindow.Close
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIPanel.SetRxMDICloseButton(AValue: TRxMDICloseButton);
|
procedure TRxMDIPanel.SetRxMDICloseButton(AValue: TRxMDICloseButton);
|
||||||
@@ -471,36 +472,29 @@ var
|
|||||||
CC:TControl;
|
CC:TControl;
|
||||||
i:integer;
|
i:integer;
|
||||||
begin
|
begin
|
||||||
{
|
if (FMainPanel.ControlCount>1) and (not Application.Terminated) then
|
||||||
DebugLn(['FMainPanel.ControlCount = ', FMainPanel.ControlCount]);
|
|
||||||
for i:=0 to FMainPanel.ControlCount-1 do
|
|
||||||
DebugLn(['FMainPanel.Controls[',i,'].Name = ', FMainPanel.Controls[i].Name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (FMainPanel.ControlCount>1) then
|
|
||||||
begin
|
begin
|
||||||
CC:=FMainPanel.Controls[FMainPanel.ControlCount-2];
|
CC:=FMainPanel.Controls[FMainPanel.ControlCount-2];
|
||||||
|
|
||||||
if Assigned(CC) then
|
if Assigned(CC) then
|
||||||
ShowWindow(CC as TForm)
|
ShowWindow(CC as TForm)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
FMainPanel.CurrentChildWindow:=nil;
|
FMainPanel.CurrentChildWindow:=nil;
|
||||||
Invalidate;
|
// Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDITasks.DoCloseAll(AIgnoreBtn: TRxMDIButton);
|
procedure TRxMDITasks.DoCloseAll(AIgnoreBtn: TRxMDIButton);
|
||||||
var
|
var
|
||||||
i:integer;
|
i:integer;
|
||||||
begin
|
begin
|
||||||
// DebugLn('DoCloseAll');
|
|
||||||
|
|
||||||
for i:=ComponentCount-1 downto 0 do
|
for i:=ComponentCount-1 downto 0 do
|
||||||
begin
|
begin
|
||||||
if (Components[i] is TRxMDIButton) and (TRxMDIButton(Components[i]) <> AIgnoreBtn) then
|
if (Components[i] is TRxMDIButton) and (TRxMDIButton(Components[i]) <> AIgnoreBtn) then
|
||||||
TRxMDIButton(Components[i]).DoCloseMenu(nil);
|
TRxMDIButton(Components[i]).DoCloseMenu(nil);
|
||||||
end;
|
end;
|
||||||
|
if Assigned(AIgnoreBtn) then
|
||||||
|
FMainPanel.CurrentChildWindow:=AIgnoreBtn.FNavForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDITasks.Paint;
|
procedure TRxMDITasks.Paint;
|
||||||
@@ -624,10 +618,7 @@ begin
|
|||||||
FNavForm:=AValue;
|
FNavForm:=AValue;
|
||||||
if Assigned(FNavForm) then
|
if Assigned(FNavForm) then
|
||||||
begin
|
begin
|
||||||
FSaveClose:=FNavForm.OnClose;
|
FNavForm.AddHandlerClose(@FormClose);
|
||||||
//FSaveDeactivate:=FNavForm.OnDeactivate;
|
|
||||||
FNavForm.OnClose:=@FormClose;
|
|
||||||
//FNavForm.OnDeactivate:=@FormDeactivate;
|
|
||||||
|
|
||||||
Caption:=' '+FNavForm.Caption+' ';
|
Caption:=' '+FNavForm.Caption+' ';
|
||||||
DoCreateButtonImage;
|
DoCreateButtonImage;
|
||||||
@@ -675,7 +666,7 @@ procedure TRxMDIButton.DoCloseMenu(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
if Assigned(FNavForm) then
|
if Assigned(FNavForm) then
|
||||||
FNavForm.Close;
|
FNavForm.Close;
|
||||||
Application.ProcessMessages;
|
// Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxMDIButton.DoCloseAllMenu(Sender: TObject);
|
procedure TRxMDIButton.DoCloseAllMenu(Sender: TObject);
|
||||||
@@ -718,13 +709,12 @@ end;
|
|||||||
|
|
||||||
procedure TRxMDIButton.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure TRxMDIButton.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
if Assigned(FSaveClose) then
|
|
||||||
FSaveClose(Sender, CloseAction);
|
|
||||||
FNavPanel.ChildWindowsShowLast;
|
FNavPanel.ChildWindowsShowLast;
|
||||||
FNavPanel.ShowHiddenBtnOnResize;
|
FNavPanel.ShowHiddenBtnOnResize;
|
||||||
CloseAction:=caFree;
|
CloseAction:=caFree;
|
||||||
Owner.RemoveComponent(Self);
|
Owner.RemoveComponent(Self);
|
||||||
Free;
|
FNavPanel.FMainPanel.RemoveControl(Sender as TCustomForm);
|
||||||
|
Application.ReleaseComponent(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TRxMDIButton.CreateButton(AOwner: TRxMDITasks; AForm: TForm);
|
constructor TRxMDIButton.CreateButton(AOwner: TRxMDITasks; AForm: TForm);
|
||||||
@@ -752,9 +742,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FNavPanel.FMainPanel.HideCurrentWindow;
|
FNavPanel.FMainPanel.HideCurrentWindow;
|
||||||
FNavForm.Show;
|
FNavForm.Show;
|
||||||
//FNavForm.BringToFront;
|
|
||||||
FNavPanel.FMainPanel.CurrentChildWindow:=NavForm;
|
FNavPanel.FMainPanel.CurrentChildWindow:=NavForm;
|
||||||
//Application.MainForm.ActiveControl:=NavForm.ActiveControl;
|
|
||||||
if Assigned(FActiveControl) and FActiveControl.HandleObjectShouldBeVisible then
|
if Assigned(FActiveControl) and FActiveControl.HandleObjectShouldBeVisible then
|
||||||
FActiveControl.SetFocus;
|
FActiveControl.SetFocus;
|
||||||
end;
|
end;
|
||||||
|
@@ -44,9 +44,6 @@ interface
|
|||||||
uses SysUtils, Classes;
|
uses SysUtils, Classes;
|
||||||
|
|
||||||
type
|
type
|
||||||
{$IFNDEF RX_D4}
|
|
||||||
TSysCharSet = set of Char;
|
|
||||||
{$ENDIF}
|
|
||||||
TCharSet = TSysCharSet;
|
TCharSet = TSysCharSet;
|
||||||
|
|
||||||
{ ** Common string handling routines ** }
|
{ ** Common string handling routines ** }
|
||||||
@@ -237,12 +234,9 @@ function RomanToInt(const S: string): Longint; deprecated; //use this function f
|
|||||||
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
|
procedure StrToStrings(const S:string; const List:TStrings; const Delims:Char);
|
||||||
|
|
||||||
const
|
const
|
||||||
// CRLF = #13#10;
|
|
||||||
DigitChars = ['0'..'9'];
|
DigitChars = ['0'..'9'];
|
||||||
{$IFNDEF CBUILDER}
|
|
||||||
Brackets = ['(',')','[',']','{','}'];
|
Brackets = ['(',')','[',']','{','}'];
|
||||||
StdWordDelims = [#0..' ',',','.',';','/','\',':','''','"','`'] + Brackets;
|
StdWordDelims = [#0..' ',',','.',';','/','\',':','''','"','`'] + Brackets;
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user