mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 16:56:03 +02:00
implement TCustomForm.EnsureVisible
git-svn-id: trunk@8557 -
This commit is contained in:
parent
9347949119
commit
a38ed98e25
18
ide/main.pp
18
ide/main.pp
@ -2782,22 +2782,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject);
|
Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject);
|
||||||
var
|
begin
|
||||||
newLeft, newTop: integer;
|
|
||||||
Begin
|
|
||||||
// it was already visible, but user does not see it, try to move in view
|
// it was already visible, but user does not see it, try to move in view
|
||||||
if MessagesView.Visible then
|
MessagesView.EnsureVisible;
|
||||||
begin
|
end;
|
||||||
newLeft := MessagesView.Left;
|
|
||||||
newTop := MessagesView.Top;
|
|
||||||
if newLeft + (MessagesView.Width div 2) > Screen.Width then
|
|
||||||
newLeft := 0;
|
|
||||||
if newTop + (MessagesView.Height div 2) > Screen.Height then
|
|
||||||
newTop := Screen.Height - MessagesView.Height - 25;
|
|
||||||
MessagesView.SetBounds(newLeft, newTop, MessagesView.Width, MessagesView.Height);
|
|
||||||
end;
|
|
||||||
MessagesView.ShowOnTop;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
||||||
Begin
|
Begin
|
||||||
|
@ -478,6 +478,7 @@ type
|
|||||||
procedure Hide;
|
procedure Hide;
|
||||||
procedure Show;
|
procedure Show;
|
||||||
procedure ShowOnTop;
|
procedure ShowOnTop;
|
||||||
|
procedure EnsureVisible(AMoveToTop: boolean = true);
|
||||||
function NeedParentForAutoSize: Boolean; override;
|
function NeedParentForAutoSize: Boolean; override;
|
||||||
function WantChildKey(Child : TControl;
|
function WantChildKey(Child : TControl;
|
||||||
var Message : TLMessage): Boolean; virtual;
|
var Message : TLMessage): Boolean; virtual;
|
||||||
|
@ -701,6 +701,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomForm.EnsureVisible(AMoveToTop: boolean = true);
|
||||||
|
var
|
||||||
|
newLeft, newTop: integer;
|
||||||
|
begin
|
||||||
|
newLeft := Left;
|
||||||
|
newTop := Top;
|
||||||
|
if newLeft + (Width div 2) > Screen.Width then
|
||||||
|
newLeft := Screen.Width - Width;
|
||||||
|
if newLeft < 0 then
|
||||||
|
newLeft := 0;
|
||||||
|
if newTop + (Height div 2) + 24 > Screen.Height then
|
||||||
|
newTop := Screen.Height - Height - 24;
|
||||||
|
if newTop < 0 then
|
||||||
|
newTop := 0;
|
||||||
|
SetBounds(newLeft, newTop, Width, Height);
|
||||||
|
if AMoveToTop then
|
||||||
|
ShowOnTop
|
||||||
|
else
|
||||||
|
Show;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomForm.FormUpdating: boolean;
|
function TCustomForm.FormUpdating: boolean;
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
Loading…
Reference in New Issue
Block a user