mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 00:18:16 +02:00
LCL: Allow only one "Default" MenuItem per menu or submenu. Issue #41034, patch by Massimo Magnano.
This commit is contained in:
parent
f65e2a2aea
commit
d9ef4ae9ab
@ -1203,9 +1203,17 @@ end;
|
|||||||
Makes a menuItem the default item (BOLD).
|
Makes a menuItem the default item (BOLD).
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TMenuItem.SetDefault(AValue: Boolean);
|
procedure TMenuItem.SetDefault(AValue: Boolean);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
FDefault := AValue;
|
if FDefault = AValue then exit;
|
||||||
//TODO: Add runtime code here
|
if AValue and (FParent <> nil) then
|
||||||
|
// Only one item in a menu or submenu can be default.
|
||||||
|
for i:=0 to FParent.Count-1 do
|
||||||
|
if FParent[i].Default then
|
||||||
|
FParent[i].FDefault := False;
|
||||||
|
FDefault:= AValue;
|
||||||
|
MenuChanged(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user