Merge 48007 from trunk:
Tell NSTextField to send us its action message and respond to it so we can generate wxEVT_COMMAND_TEXT_ENTER. Copyright 2007 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -50,6 +50,7 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
protected:
|
protected:
|
||||||
virtual void Cocoa_didChangeText(void);
|
virtual void Cocoa_didChangeText(void);
|
||||||
|
virtual void CocoaTarget_action(void);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// Implementation
|
// Implementation
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@@ -59,6 +59,10 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID winid,
|
|||||||
if(m_parent)
|
if(m_parent)
|
||||||
m_parent->CocoaAddChild(this);
|
m_parent->CocoaAddChild(this);
|
||||||
SetInitialFrameRect(pos,size);
|
SetInitialFrameRect(pos,size);
|
||||||
|
|
||||||
|
[(NSTextField*)m_cocoaNSView setTarget: sm_cocoaTarget];
|
||||||
|
[(NSTextField*)m_cocoaNSView setAction:@selector(wxNSControlAction:)];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +75,19 @@ void wxTextCtrl::Cocoa_didChangeText(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxTextCtrl::CocoaTarget_action(void)
|
||||||
|
{
|
||||||
|
// NSTextField only sends the action message on enter key press and thus
|
||||||
|
// we send the appropriate event type.
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId());
|
||||||
|
|
||||||
|
// See wxTextCtrlBase::SendTextUpdatedEvent for why we don't set the string.
|
||||||
|
//event.SetString(GetValue());
|
||||||
|
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void wxTextCtrl::AppendText(wxString const&)
|
void wxTextCtrl::AppendText(wxString const&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user