mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 06:18:21 +02:00
Cocoa: CaseSensitive supported in TCocoaComboBox.comboBox_indexOfItemWithStringValue()
This commit is contained in:
parent
6d9db64d24
commit
85afe93ad6
@ -447,6 +447,8 @@ function GetFieldEditor(afield: NSTextField): TCocoaFieldEditor;
|
||||
|
||||
implementation
|
||||
|
||||
uses CocoaWSStdCtrls;
|
||||
|
||||
function GetFieldEditor(afield: NSTextField): TCocoaFieldEditor;
|
||||
var
|
||||
lFieldEditor: TCocoaFieldEditor;
|
||||
@ -1407,8 +1409,7 @@ begin
|
||||
Result:=idx
|
||||
else
|
||||
begin
|
||||
// todo: consider a faster search?
|
||||
idx := list.IndexOf(string_.UTF8String);
|
||||
idx := TCocoaWSCustomComboBox.GetObjectItemIndex(aComboBox.lclGetTarget);
|
||||
if idx<0 then
|
||||
Result := NSNotFound
|
||||
else
|
||||
|
@ -76,6 +76,7 @@ type
|
||||
TCocoaWSCustomComboBox = class(TWSCustomComboBox)
|
||||
public
|
||||
class function getNSText(const ACustomComboBox: TCustomComboBox): NSText;
|
||||
class function GetObjectItemIndex(const AObject: TObject): integer;
|
||||
published
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||
@ -1931,6 +1932,14 @@ begin
|
||||
Result:= txt.selectedRange.length;
|
||||
end;
|
||||
|
||||
class function TCocoaWSCustomComboBox.GetObjectItemIndex(const AObject: TObject): integer;
|
||||
begin
|
||||
if AObject is TCustomComboBox then
|
||||
Result:= GetItemIndex( TCustomComboBox(AObject) )
|
||||
else
|
||||
Result:= -1;
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomComboBox.SetSelStart(
|
||||
const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
var
|
||||
@ -1973,7 +1982,7 @@ begin
|
||||
if ComboBoxStyleIsReadOnly(ACustomComboBox.Style) then
|
||||
idx := TCocoaReadOnlyComboBox(ACustomComboBox.Handle).indexOfSelectedItem
|
||||
else
|
||||
idx := TCocoaComboBox(ACustomComboBox.Handle).indexOfSelectedItem;
|
||||
idx := ACustomComboBox.MatchListItem(ACustomComboBox.Text);
|
||||
if idx = NSNotFound then
|
||||
Result := -1
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user