when the listctrl is clicked on. It has to do with a dependency on
the order of focus events so on wxMac we'll just explicitly dismiss
the edit control if it's active when the listctrl is clicked on.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36720
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
public:
wxListTextCtrl(wxListMainWindow *owner, size_t itemEdit);
public:
wxListTextCtrl(wxListMainWindow *owner, size_t itemEdit);
+ void AcceptChangesAndFinish();
+
protected:
void OnChar( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
protected:
void OnChar( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
m_lineBeforeLastClicked,
m_lineSelectSingleOnUp;
m_lineBeforeLastClicked,
m_lineSelectSingleOnUp;
+ wxListTextCtrl* m_textctrl;
+
protected:
// the total count of items in a virtual list control
size_t m_countVirt;
protected:
// the total count of items in a virtual list control
size_t m_countVirt;
if ( !m_finished )
{
wxPendingDelete.Append(this);
if ( !m_finished )
{
wxPendingDelete.Append(this);
+ m_owner->m_textctrl = NULL;
+
m_finished = true;
m_owner->SetFocusIgnoringChildren();
m_finished = true;
m_owner->SetFocusIgnoringChildren();
+void wxListTextCtrl::AcceptChangesAndFinish()
+{
+ m_aboutToFinish = true;
+ // Notify the owner about the changes
+ AcceptChanges();
+ // Even if vetoed, close the control (consistent with MSW)
+ Finish();
+}
+
void wxListTextCtrl::OnChar( wxKeyEvent &event )
{
switch ( event.m_keyCode )
{
case WXK_RETURN:
void wxListTextCtrl::OnChar( wxKeyEvent &event )
{
switch ( event.m_keyCode )
{
case WXK_RETURN:
- m_aboutToFinish = true;
- // Notify the owner about the changes
- AcceptChanges();
- // Even if vetoed, close the control (consistent with MSW)
- Finish();
+ AcceptChangesAndFinish();
m_lastOnSame = false;
m_renameTimer = new wxListRenameTimer( this );
m_lastOnSame = false;
m_renameTimer = new wxListRenameTimer( this );
m_current =
m_lineLastClicked =
m_lineSelectSingleOnUp =
m_current =
m_lineLastClicked =
m_lineSelectSingleOnUp =
if ( m_dirty )
wxSafeYield();
if ( m_dirty )
wxSafeYield();
- wxListTextCtrl *text = new wxListTextCtrl(this, itemEdit);
-
- text->SetFocus();
+ m_textctrl = new wxListTextCtrl(this, itemEdit);
+ m_textctrl->SetFocus();
}
void wxListMainWindow::OnRenameTimer()
}
void wxListMainWindow::OnRenameTimer()
void wxListMainWindow::OnMouse( wxMouseEvent &event )
{
void wxListMainWindow::OnMouse( wxMouseEvent &event )
{
+#ifdef __WXMAC__
+ // On wxMac we can't depend on the EVT_KILL_FOCUS event to properly
+ // shutdown the edit control when the mouse is clicked elsewhere on the
+ // listctrl because the order of events is different (or something like
+ // that,) so explicitly end the edit if it is active.
+ if ( event.LeftDown() && m_textctrl)
+ {
+ m_textctrl->AcceptChangesAndFinish();
+ }
+#endif
+
event.SetEventObject( GetParent() );
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
return;
event.SetEventObject( GetParent() );
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
return;