mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 14:19:10 +02:00
Cocoa: TCocoaComboBox: refactor and comments
This commit is contained in:
parent
b9b1f7f310
commit
8b426df777
@ -1402,19 +1402,25 @@ function TCocoaComboBox.comboBox_indexOfItemWithStringValue(
|
|||||||
aComboBox: NSComboBox; string_: NSString): NSUInteger;
|
aComboBox: NSComboBox; string_: NSString): NSUInteger;
|
||||||
var
|
var
|
||||||
idx : integer;
|
idx : integer;
|
||||||
|
lclString: String;
|
||||||
|
lclCmb : TObject;
|
||||||
begin
|
begin
|
||||||
idx := indexOfSelectedItem;
|
idx := indexOfSelectedItem;
|
||||||
if (idx>=0) and (idx<list.Count) and (list[idx]=string_.UTF8String) then
|
lclString := string_.UTF8String;
|
||||||
|
lclCmb := lclGetTarget;
|
||||||
|
if (idx>=0) and (idx<list.Count) and (list[idx]=lclString) then
|
||||||
// this is used for the case of the same items in the combobox
|
// this is used for the case of the same items in the combobox
|
||||||
Result:=idx
|
Result:=idx
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
idx := TCocoaWSCustomComboBox.GetObjectItemIndex(aComboBox.lclGetTarget);
|
idx := TCocoaWSCustomComboBox.GetObjectItemIndex(lclCmb);
|
||||||
if idx<0 then
|
if idx<0 then
|
||||||
Result := NSNotFound
|
Result := NSNotFound
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
TComboBoxAsyncHelper.ResetTextIfNecessary(lclGetTarget, string_.UTF8String);
|
// ComboBox.Text will be set to the List Item value after comboBox_indexOfItemWithStringValue()
|
||||||
|
// so if cbactRetainPrefixCase set, ComboBox.Text should be reset Async
|
||||||
|
TComboBoxAsyncHelper.ResetTextIfNecessary(lclCmb, lclString);
|
||||||
Result := idx;
|
Result := idx;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user