mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 10:17:21 +01:00
fixed clsing popupmenu on showmodal
git-svn-id: trunk@4148 -
This commit is contained in:
parent
2007425c74
commit
4fbdd8f2b6
@ -1348,7 +1348,10 @@ var
|
||||
//SaveCount: Integer;
|
||||
ActiveWindow: HWnd;
|
||||
begin
|
||||
// cancel drags
|
||||
CancelDrag;
|
||||
// close popupmenus
|
||||
if ActivePopupMenu<>nil then ActivePopupMenu.Close;
|
||||
//writeln('[TCustomForm.ShowModal] START ',Classname);
|
||||
if Visible or not Enabled or (fsModal in FFormState)
|
||||
or (FormStyle = fsMDIChild) then
|
||||
@ -1414,6 +1417,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.98 2003/05/12 13:40:50 mattias
|
||||
fixed clsing popupmenu on showmodal
|
||||
|
||||
Revision 1.97 2003/04/20 16:32:58 mattias
|
||||
published keypreview
|
||||
|
||||
|
||||
@ -40,18 +40,43 @@ begin
|
||||
FAutoPopup := True;
|
||||
end;
|
||||
|
||||
destructor TPopupMenu.Destroy;
|
||||
begin
|
||||
Close;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
Procedure TPopupMenu.PopUp(X,Y : Integer);
|
||||
begin
|
||||
if ActivePopupMenu<>nil then ActivePopupMenu.Close;
|
||||
FPopupPoint := Point(X, Y);
|
||||
DoPopup(Self);
|
||||
if Items.Count=0 then exit;
|
||||
ActivePopupMenu:=Self;
|
||||
HandleNeeded;
|
||||
SendMsgToInterface(LM_POPUPSHOW, Self, @FPopupPoint);
|
||||
end;
|
||||
|
||||
procedure TPopupMenu.Close;
|
||||
begin
|
||||
if HandleAllocated then FItems.DestroyHandle;
|
||||
if ActivePopupMenu=Self then begin
|
||||
DoClose;
|
||||
ActivePopupMenu:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPopupMenu.DoClose;
|
||||
begin
|
||||
if Assigned(OnClose) then OnClose(Self);
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 2003/05/12 13:40:50 mattias
|
||||
fixed clsing popupmenu on showmodal
|
||||
|
||||
Revision 1.7 2003/04/06 22:39:47 mattias
|
||||
implemented searching packages
|
||||
|
||||
|
||||
10
lcl/menus.pp
10
lcl/menus.pp
@ -269,6 +269,7 @@ type
|
||||
TPopupMenu = class(TMenu)
|
||||
private
|
||||
FAutoPopup : Boolean;
|
||||
FOnClose: TNotifyEvent;
|
||||
FOnPopup: TNotifyEvent;
|
||||
FPopupComponent : TComponent;
|
||||
FPopupPoint: TPoint;
|
||||
@ -276,13 +277,17 @@ type
|
||||
procedure DoPopup(Sender: TObject); virtual;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure PopUp(X, Y : Integer);
|
||||
property PopupComponent: TComponent read FPopupComponent
|
||||
write FPopupComponent;
|
||||
property PopupPoint: TPoint read FPopupPoint;
|
||||
procedure Close;
|
||||
procedure DoClose;
|
||||
published
|
||||
property AutoPopup: Boolean read FAutoPopup write FAutoPopup default True;
|
||||
property OnPopup: TNotifyEvent read FOnPopup write FOnPopup;
|
||||
property OnClose: TNotifyEvent read FOnClose write FOnClose;
|
||||
end;
|
||||
|
||||
|
||||
@ -308,6 +313,7 @@ function ShortCutToText(ShortCut: TShortCut): string;
|
||||
|
||||
var
|
||||
DesignerMenuItemClick: TNotifyEvent;
|
||||
ActivePopupMenu: TPopupMenu;
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -374,11 +380,15 @@ end;
|
||||
|
||||
initialization
|
||||
DesignerMenuItemClick:=nil;
|
||||
ActivePopupMenu:=nil;
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 2003/05/12 13:40:50 mattias
|
||||
fixed clsing popupmenu on showmodal
|
||||
|
||||
Revision 1.42 2003/05/02 22:22:15 mattias
|
||||
localization, added context policy to make resource string dialog
|
||||
|
||||
|
||||
@ -1122,6 +1122,7 @@ begin
|
||||
|
||||
FilesPopupMenu:=TPopupMenu.Create(Self);
|
||||
with FilesPopupMenu do begin
|
||||
Name:='FilesPopupMenu';
|
||||
OnPopup:=@FilesPopupMenuPopup;
|
||||
end;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user