From: Carl G. <cg...@gm...> - 2005-11-23 15:54:21
|
Hi, I'm using wxTreeListCtrl on both Linux and Windows with wx 2.6.1. There is one problem I can't quite figure out though I have to admit I have not looked into it in detail yet but was hoping someone would know immediately what I was doing wrong. When I create the control and populate it with more items than fit vertical= ly, I don't get a scrollbar right away until I click on one of the items. This happens both on Windows and Linux so I presume it's intentional. However, I'd like to always show the vertical scrollbar so that the user knows there= are more items below. Is there some way I can force this? By the way, I am using the wxTR_HIDE_ROOT style in my interface. I mention this since there used to be some bugs related to this style at one time. Thanks, carl |
From: Otto W. <ott...@or...> - 2005-11-23 17:14:04
|
Carl Godkin wrote: >When I create the control and populate it with more items than fit vertically, >I don't get a scrollbar right away until I click on one of the items. This >happens both on Windows and Linux so I presume it's intentional. However, >I'd like to always show the vertical scrollbar so that the user knows there are >more items below. > > > I've seen this as well lately and think it's something wrong within wxWidgets but I'm not sure. I haven't seen it in any of my old apps, only in the new TorMgr I write for the Tor GUI contest. So it might be a problem of 2.6.2, again I'm not sure. >Is there some way I can force this? > > > Either try to use the vertical scroll bar style for always showing it or send a size event to it, maybe a simple SetSize outside the constructor might be sufficiant. >By the way, I am using the wxTR_HIDE_ROOT style in my interface. I mention >this since there used to be some bugs related to this style at one time. > > > Ditto I, so far all my trees use this style. O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |
From: Carl G. <cg...@gm...> - 2005-11-23 17:39:38
|
On 11/23/05, Otto Wyss <ott...@or...> wrote: > Carl Godkin wrote: > > >When I create the control and populate it with more items than fit verti= cally, > >I don't get a scrollbar right away until I click on one of the items. T= his > >happens both on Windows and Linux so I presume it's intentional. Howeve= r, > >I'd like to always show the vertical scrollbar so that the user knows th= ere are > >more items below. > > > > > > > I've seen this as well lately and think it's something wrong within > wxWidgets but I'm not sure. I haven't seen it in any of my old apps, > only in the new TorMgr I write for the Tor GUI contest. So it might be a > problem of 2.6.2, again I'm not sure. > > >Is there some way I can force this? I looked into this and found the problem, I think. The member function wxTreeListMainWindow::AdjustMyScrollbars() calls GetSize() on the root item. However wxTreeListItem::GetSize() doesn't think the root item is expanded, so all you get is the (hidden) root item's size. I worked around this by adding Expand(rootId) after I populate the tree initially and now the vertical scrollbar appears as I think it should. This even makes sense to me. I wondered if this problem would happen in the generic tree control which was apparently the model for the tree list control but found that there is a little code we might wa= nt to add to avoid this problem. Notice the difference here: void wxTreeListMainWindow::SetWindowStyle (const long styles) { // right now, just sets the styles. Eventually, we may // want to update the inherited styles, but right now // none of the parents has updatable styles m_windowStyle =3D styles; m_dirty =3D true; } void wxGenericTreeCtrl::SetWindowStyle(const long styles) { if (!HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) { // if we will hide the root, make sure children are visible m_anchor->SetHasPlus(); m_anchor->Expand(); CalculatePositions(); } // right now, just sets the styles. Eventually, we may // want to update the inherited styles, but right now // none of the parents has updatable styles m_windowStyle =3D styles; m_dirty =3D true; } (Note that m_anchor in the generic tree control is the same as m_rootItem in the tree list control.) Thanks, carl |
From: Otto W. <ott...@or...> - 2005-11-23 18:28:52
|
Carl Godkin wrote: > if (!HasFlag(wxTR_HIDE_ROOT) && (styles & wxTR_HIDE_ROOT)) > { > // if we will hide the root, make sure children are visible > m_anchor->SetHasPlus(); > m_anchor->Expand(); > } > > > True, the root item should always be expanded if hidden. I've added the above statements in the AddRoot function since this is IMO the better place. So far it seems to work in the TorMgr. O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |
From: Otto W. <ott...@or...> - 2005-11-24 16:33:51
|
Otto Wyss wrote: > True, the root item should always be expanded if hidden. I've added > the above statements in the AddRoot function since this is IMO the > better place. So far it seems to work in the TorMgr. > I reworked the hidden root again so it stays expanded in all cases (hopefully). Please check again. O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |