Cocoa: Fix ItemIndex issue of TComboBox with csDropDownList at init

This commit is contained in:
rich2014 2024-02-17 21:21:50 +08:00
parent d019706897
commit f3d26660e7

View File

@ -489,6 +489,10 @@ begin
end else
FOwner.insertItemWithTitle_atIndex(astr, Index);
// ItemIndex may be changed in addItemWithTitle() / insertItemWithTitle_atIndex()
// keep compatibility with LCL by resetting ItemIndex
FOwner.selectItemAtIndex(FOwner.lastSelectedItemIndex);
mn := FOwner.itemAtIndex(Index);
if not Assigned(mn) then Exit;
@ -1589,7 +1593,7 @@ begin
if Assigned(selectedItem) then
Result:=selectedItem.title
else
Result:=inherited stringValue;
Result:=NSString.string_;
end;
procedure TCocoaReadOnlyComboBox.drawRect(dirtyRect: NSRect);