[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] product editor patch

From: Vaclav Slavik
Subject: Re: [lmi] product editor patch
Date: Thu, 28 Feb 2008 21:28:06 +0100
User-agent: KMail/1.9.9

Greg Chicares wrote:
> * A '.db4' file opens with the tree control bottom aligned, with
> its third (logical) item focused. I'd rather have it top aligned,
> with the first item focused, unless that contradicts the way msw
> normally does things. (Maybe this is observable only with the
> 800x600 resolution I use.)

The following patch fixes this:

Index: multidimgrid_tools.cpp
RCS file: /sources/lmi/lmi/multidimgrid_tools.cpp,v
retrieving revision 1.6
diff -u -u -r1.6 multidimgrid_tools.cpp
--- multidimgrid_tools.cpp      1 Jan 2008 18:29:50 -0000       1.6
+++ multidimgrid_tools.cpp      28 Feb 2008 20:20:33 -0000
@@ -84,7 +84,10 @@

     wxSize best_size(0, 0);

-    wxTreeItemId root = GetRootItem();
+    const wxTreeItemId selection = GetSelection();
+    const wxTreeItemId first_visible = GetFirstVisibleItem();
+    const wxTreeItemId root = GetRootItem();
     myself.DoGetBestSizePrivate(best_size, root, true);

     // need some minimal size even for an empty tree
@@ -99,6 +102,11 @@
     best_size += GetSize() - GetClientSize();

+    if(selection.IsOk())
+        myself.SelectItem(selection);
+    if(first_visible.IsOk())
+        myself.ScrollTo(first_visible);

     return best_size;

AutoResizingTreeCtrl does some tricks to compute full extent of
expanded tree in its DoGetBestSize() and it wasn't fully restoring
its state without this patch. (It looks like wxTreeCtrl contains code
that is supposed to do this, but incorrectly, so I may end up
removing AutoResizingTreeCtrl completely and moving the code to wx.)


PGP key: 0x465264C9, available from http://pgp.mit.edu/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]