are trigger if the user app shows dialog in reaction to
the user pressing e.g. <ENTER>. The edit text control will
lose focus and emit another event. Might be possible to
fix without adding another field, but this way it surely
works.
Also added correction to treecontrol as per listcontrol in
the situation when a label change happens by losing the
focus and the user cannot reject it, another event is emitted.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32632
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxString m_startValue;
size_t m_itemEdited;
bool m_finished;
wxString m_startValue;
size_t m_itemEdited;
bool m_finished;
{
m_owner = owner;
m_finished = false;
{
m_owner = owner;
m_finished = false;
+ m_aboutToFinish = false;
wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
switch ( event.m_keyCode )
{
case WXK_RETURN:
switch ( event.m_keyCode )
{
case WXK_RETURN:
+ m_aboutToFinish = true;
// Notify the owner about the changes
AcceptChanges();
// Notify the owner about the changes
AcceptChanges();
// Even if vetoed, close the control (consistent with MSW)
Finish();
// Even if vetoed, close the control (consistent with MSW)
Finish();
}
// We must let the native text control handle focus, too, otherwise
}
// We must let the native text control handle focus, too, otherwise
- // it could have problems with the cursor (e.g., in wxGTK):
+ // it could have problems with the cursor (e.g., in wxGTK).
wxGenericTreeItem *m_itemEdited;
wxString m_startValue;
bool m_finished;
wxGenericTreeItem *m_itemEdited;
wxString m_startValue;
bool m_finished;
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxTreeTextCtrl)
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(wxTreeTextCtrl)
{
m_owner = owner;
m_finished = false;
{
m_owner = owner;
m_finished = false;
+ m_aboutToFinish = false;
int w = m_itemEdited->GetWidth(),
h = m_itemEdited->GetHeight();
int w = m_itemEdited->GetWidth(),
h = m_itemEdited->GetHeight();
void wxTreeTextCtrl::Finish()
{
void wxTreeTextCtrl::Finish()
{
+ if ( !m_finished && !m_aboutToFinish )
{
m_owner->ResetTextControl();
{
m_owner->ResetTextControl();
switch ( event.m_keyCode )
{
case WXK_RETURN:
switch ( event.m_keyCode )
{
case WXK_RETURN:
+ m_aboutToFinish = true;
// Notify the owner about the changes
AcceptChanges();
// Notify the owner about the changes
AcceptChanges();
// Even if vetoed, close the control (consistent with MSW)
Finish();
// Even if vetoed, close the control (consistent with MSW)
Finish();
// We must finish regardless of success, otherwise we'll get
// focus problems:
Finish();
// We must finish regardless of success, otherwise we'll get
// focus problems:
Finish();
+
+ if ( !AcceptChanges() )
+ m_owner->OnRenameCancelled( m_itemEdited );
}
// We must let the native text control handle focus, too, otherwise
}
// We must let the native text control handle focus, too, otherwise
- // it could have problems with the cursor (e.g., in wxGTK):
+ // it could have problems with the cursor (e.g., in wxGTK).