In order to get all focus set events, store field in editor and catch
becomeFirstResponder there
See #14269.
(this is a backport of cea11b5
from master)
This commit is contained in:
committed by
Dimitri Schoolwerth
parent
6a961dd2d9
commit
b67dea6fc0
@@ -324,8 +324,10 @@ public:
|
|||||||
@interface wxNSTextFieldEditor : NSTextView
|
@interface wxNSTextFieldEditor : NSTextView
|
||||||
{
|
{
|
||||||
NSEvent* lastKeyDownEvent;
|
NSEvent* lastKeyDownEvent;
|
||||||
|
NSTextField* textField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setTextField:(NSTextField*) field;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface wxNSTextField : NSTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>)
|
@interface wxNSTextField : NSTextField wxOSX_10_6_AND_LATER(<NSTextFieldDelegate>)
|
||||||
|
@@ -507,6 +507,7 @@ extern int wxOSXGetIdFromSelector(SEL action );
|
|||||||
{
|
{
|
||||||
editor = [[wxNSTextFieldEditor alloc] init];
|
editor = [[wxNSTextFieldEditor alloc] init];
|
||||||
[editor setFieldEditor:YES];
|
[editor setFieldEditor:YES];
|
||||||
|
[editor setTextField:tf];
|
||||||
[tf setFieldEditor:editor];
|
[tf setFieldEditor:editor];
|
||||||
[editor release];
|
[editor release];
|
||||||
}
|
}
|
||||||
@@ -520,6 +521,7 @@ extern int wxOSXGetIdFromSelector(SEL action );
|
|||||||
{
|
{
|
||||||
editor = [[wxNSTextFieldEditor alloc] init];
|
editor = [[wxNSTextFieldEditor alloc] init];
|
||||||
[editor setFieldEditor:YES];
|
[editor setFieldEditor:YES];
|
||||||
|
[editor setTextField:cb];
|
||||||
[cb setFieldEditor:editor];
|
[cb setFieldEditor:editor];
|
||||||
[editor release];
|
[editor release];
|
||||||
}
|
}
|
||||||
|
@@ -298,6 +298,29 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
|||||||
[super insertText:str];
|
[super insertText:str];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) resignFirstResponder
|
||||||
|
{
|
||||||
|
return [super resignFirstResponder];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) becomeFirstResponder
|
||||||
|
{
|
||||||
|
// we need the stored text field, as at this point the delegate is not yet set
|
||||||
|
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) textField );
|
||||||
|
|
||||||
|
BOOL r = [super becomeFirstResponder];
|
||||||
|
if ( impl != NULL && r )
|
||||||
|
impl->DoNotifyFocusSet();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setTextField:(NSTextField*) field
|
||||||
|
{
|
||||||
|
textField = field;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation wxNSTextView
|
@implementation wxNSTextView
|
||||||
|
Reference in New Issue
Block a user