mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 21:59:23 +02:00
Cocoa: support keyboard in TCustomComboBox (TCocoaReadOnlyComboBox)
This commit is contained in:
parent
a914ea80b1
commit
db6685cd02
@ -319,7 +319,9 @@ type
|
||||
TCocoaReadOnlyComboBoxMenuDelegate = objcclass( NSObject, NSMenuDelegateProtocol )
|
||||
private
|
||||
_lastHightlightItem: NSMenuItem;
|
||||
_comboBox: NSPopUpButton;
|
||||
procedure menu_willHighlightItem (menu: NSMenu; item: NSMenuItem);
|
||||
procedure menuDidClose (menu: NSMenu);
|
||||
end;
|
||||
|
||||
{ TCocoaReadOnlyComboBox }
|
||||
@ -712,8 +714,6 @@ begin
|
||||
if Assigned(combobox) then
|
||||
begin
|
||||
combobox.selectItemAtIndex(itemIndex);
|
||||
combobox.callback.ComboBoxSelectionDidChange;
|
||||
combobox.menu.performActionForItemAtIndex(itemIndex);
|
||||
combobox.menu.cancelTracking;
|
||||
end;
|
||||
end;
|
||||
@ -1608,6 +1608,7 @@ begin
|
||||
Result:=inherited initWithFrame(frameRect);
|
||||
_defaultItemHeight:= CocoaConfigComboBox.readOnly.item.defaultHeight;
|
||||
_menuDelegate:= TCocoaReadOnlyComboBoxMenuDelegate.new;
|
||||
_menuDelegate._comboBox:= self;
|
||||
self.menu.setDelegate( _menuDelegate );
|
||||
end;
|
||||
|
||||
@ -1867,6 +1868,11 @@ begin
|
||||
_lastHightlightItem:= item;
|
||||
end;
|
||||
|
||||
procedure TCocoaReadOnlyComboBoxMenuDelegate.menuDidClose(menu: NSMenu);
|
||||
begin
|
||||
TCocoaReadOnlyComboBox(_comboBox).comboboxAction( nil );
|
||||
end;
|
||||
|
||||
{ TCocoaSpinEdit }
|
||||
|
||||
{$IFDEF COCOA_SPINEDIT_INSIDE_CONTAINER}
|
||||
|
@ -1977,8 +1977,6 @@ begin
|
||||
if not Assigned(rocmb) then Exit;
|
||||
rocmb.isComboBoxEx:= AWinControl is TCustomComboBoxEx;
|
||||
rocmb.list:=TCocoaReadOnlyComboBoxList.Create(rocmb);
|
||||
rocmb.setTarget(rocmb);
|
||||
rocmb.setAction(objcselector('comboboxAction:'));
|
||||
rocmb.lastSelectedItemIndex:= -1;
|
||||
TComboBoxAsyncHelper.SetLastIndex(rocmb);
|
||||
rocmb.callback:=TLCLComboboxCallback.Create(rocmb, AWinControl);
|
||||
|
Loading…
Reference in New Issue
Block a user