Ticket #11179 (closed defect: fixed)

Opened 4 years ago

Last modified 8 months ago

TreeCtrl AppendItem/EditItem display bug under OS X

Reported by: fengb Owned by:
Priority: normal Milestone:
Component: wxOSX-Cocoa Version: 2.8.10
Keywords: Cc:
Blocked By: Patch: no
Blocking:

Description

When appending a new child to an expanded parent and editing it immediately, the edit box appears in an unexpected location. As far as I can tell, the edit can be used blindly, but it does not properly display the result until the editing is finished.

Appending and editing the child to a collapsed parent will work normally.

I only managed to reproduce this behavior on OS X; my Windows version works fine.

I have attached a wxPython script that replicates this buggy behavior.

Attachments

treectrlbug.py download (1.2 KB) - added by fengb 4 years ago.

Change History

Changed 4 years ago by fengb

Changed 3 years ago by vadz

Would be nice to have a C++ example reproducing this to test if it's still broken.

Changed 8 months ago by vadz

I can reproduce the problem with pre-2.9.5 using this patch

  • samples/treectrl/treetest.cpp

    diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp
    index 8e0064d..934450b 100644
    a b  
    777777    wxString text; 
    778778    text.Printf(wxT("Item #%d"), ++s_num); 
    779779 
    780     m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(), 
     780    m_treeCtrl->EditLabel(m_treeCtrl->AppendItem(m_treeCtrl->GetRootItem(), 
    781781                           text /*, 
    782                            MyTreeCtrl::TreeCtrlIcon_File */ ); 
     782                           MyTreeCtrl::TreeCtrlIcon_File */ )); 
    783783} 
    784784 

The behaviour is strange, the text control doesn't appear at all actually and editing it blindly doesn't really work neither.

However just removing the special case for wxMac in wxTreeCtrl code seems to fix it so I'll go ahead and just do this -- and wait if any new problems are uncovered by this.

Changed 8 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [72882]) Update tree control layout in EditLabel() for wxOSX too.

A special preprocessor check for OS X prevented the control from being relaid
out correctly in EditLabel() there, which resulted in problems when trying to
edit a just added item.

Simply remove this check for OS X (and also MSW but this is less important as
this version of the control is almost never used there anyhow) to fix it.

Closes #11179.

Note: See TracTickets for help on using tickets.