mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-30 05:36:31 +02:00
LCL: ColorBox - keep FSelected in sync all the time. fixes issue #22729
git-svn-id: trunk@38396 -
This commit is contained in:
parent
9fbffd805b
commit
d444ee76f9
@ -376,8 +376,15 @@ begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
if ItemIndex <> -1 then
|
||||
Result := Colors[ItemIndex]
|
||||
else
|
||||
begin
|
||||
Result := Colors[ItemIndex];
|
||||
// keep FSelected in sync
|
||||
if FSelected <> Result then
|
||||
begin
|
||||
// DebugLn('WARNING TCustomColorBox: FSelected out of sync with Colors[0]');
|
||||
FSelected := Result;
|
||||
end;
|
||||
end else
|
||||
Result := FSelected;
|
||||
end
|
||||
else
|
||||
@ -432,7 +439,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomColorBox.SetSelected(Value: TColor);
|
||||
begin
|
||||
if Selected = Value then
|
||||
if FSelected = Value then
|
||||
Exit;
|
||||
|
||||
FSelected := Value;
|
||||
@ -620,7 +627,7 @@ begin
|
||||
if (cbCustomColor in Style) and (ItemIndex = 0) then // custom color has been selected
|
||||
PickCustomColor;
|
||||
if ItemIndex <> -1 then
|
||||
FSelected := Colors[ItemIndex];
|
||||
Selected := Colors[ItemIndex];
|
||||
inherited CloseUp;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user