Implement doCommandBySelector for the wxNSComboBox class
* Use the same code as for wxNSTextField (copy-pasted). * This method is used to redirect the enter key event to the OnChar event. * This makes it possible to implement the default button activation by pressing the enter key (for comboboxes which doesn't have the wxTE_PROCESS_ENTER style).
This commit is contained in:
@@ -158,6 +158,44 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector
|
||||||
|
{
|
||||||
|
wxUnusedVar(textView);
|
||||||
|
wxUnusedVar(control);
|
||||||
|
|
||||||
|
BOOL handled = NO;
|
||||||
|
|
||||||
|
// send back key events wx' common code knows how to handle
|
||||||
|
|
||||||
|
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||||
|
if ( impl )
|
||||||
|
{
|
||||||
|
wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
|
||||||
|
if ( wxpeer )
|
||||||
|
{
|
||||||
|
if (commandSelector == @selector(insertNewline:))
|
||||||
|
{
|
||||||
|
[textView insertNewlineIgnoringFieldEditor:self];
|
||||||
|
handled = YES;
|
||||||
|
}
|
||||||
|
else if ( commandSelector == @selector(insertTab:))
|
||||||
|
{
|
||||||
|
[textView insertTabIgnoringFieldEditor:self];
|
||||||
|
handled = YES;
|
||||||
|
}
|
||||||
|
else if ( commandSelector == @selector(insertBacktab:))
|
||||||
|
{
|
||||||
|
[textView insertTabIgnoringFieldEditor:self];
|
||||||
|
handled = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
wxNSComboBoxControl::wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w )
|
wxNSComboBoxControl::wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w )
|
||||||
|
Reference in New Issue
Block a user