Now to get right tabbing on Cocoa with plugin control?

I made a NSSearchFieldControlMBS recently.
It uses a NSSearchField subclass with the mixing from you:

REAL_VIEW_MIXINS(controlInstance);
REAL_DND_MIXINS(controlInstance, MyNSSearchFieldControlMBS);

now we still have problems with using tab key from this control to another control, e.g. a listbox.
Is there anything we need to do here?

REALcontrolAcceptFocus is set for the control.

And gainedFocusFunction/lostFocusFunction functions are not defined, but still I don’t see focus events for my control in Xojo. Any idea?

[quote=39330:@Christian Schmitz]I made a NSSearchFieldControlMBS recently.
It uses a NSSearchField subclass with the mixing from you:

REAL_VIEW_MIXINS(controlInstance);
REAL_DND_MIXINS(controlInstance, MyNSSearchFieldControlMBS);

now we still have problems with using tab key from this control to another control, e.g. a listbox.
Is there anything we need to do here?

REALcontrolAcceptFocus is set for the control.

And gainedFocusFunction/lostFocusFunction functions are not defined, but still I don’t see focus events for my control in Xojo. Any idea?[/quote]

You should read up on how Cocoa’s field editor system.

Essentially what’s happening is that as soon as your NSSearchField gets focus, an NSTextView is embedded into it and focus is forwarded to it. After that, the NSSearchField gets no key down events and you can’t pass the tab key events to the framework so that it can advance focus. One approach to solving this would be to have a custom field editor, which forwards the key events to the framework.

Hm, I still have this problem, but I’m not sure how to provide a custom field editor without changing NSWindow. Maybe the framework should maybe implement

  • (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject;

What do you think?

[quote=49882:@Christian Schmitz]Hm, I still have this problem, but I’m not sure how to provide a custom field editor without changing NSWindow. Maybe the framework should maybe implement

  • (NSText *)fieldEditor:(BOOL)createFlag forObject:(id)anObject;

What do you think?[/quote]

Your NSCell subclass can return its own field editor from -fieldEditorForView:

Thank you joe, that did it.