mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-24 03:59:29 +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).
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TMenuItem.SetDefault(AValue: Boolean);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FDefault = AValue then exit;
|
||||
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;
|
||||
//TODO: Add runtime code here
|
||||
MenuChanged(True);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user