Hi all,

I was thinking that when I open a folder with unread messages, or
hit Ctrl-U, I usually like to see what the other messages in the
folder, just after the selected one, look like.

But M only makes sure that the selected message is displayed, and if
some scrolling is necessary, it only scrolls just enough to show the
message, and not the subsequent ones.

So I did hack the wxListView code to make sure that:
- the selected message is visible
- the next messages (up to 4) are also visible
- the previous message is visible

The patch is attached.

Do you like this feature?

-- 
Xavier Nodet
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin, 1759.
cvs diff -u include\wx\listctrl.h (in directory U:\src\wxWindows\)
Index: include/wx/listctrl.h
===================================================================
RCS file: /pack/cvsroots/wxwindows/wxWindows/include/wx/listctrl.h,v
retrieving revision 1.55
diff -u -r1.55 listctrl.h
--- include/wx/listctrl.h       2004/01/15 13:48:12     1.55
+++ include/wx/listctrl.h       2004/04/15 08:42:29
@@ -62,6 +62,17 @@
     void Focus(long index)
     {
         SetItemState(index, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
+        // Start with the selected item, then make sure it scrolls up
+        // by (at most) 4 positions
+        EnsureVisible(index);
+        EnsureVisible(index+1);
+        EnsureVisible(index+2);
+        EnsureVisible(index+3);
+        EnsureVisible(index+4);
+        // Show one item above
+        EnsureVisible(index-1);
+        // In case we have less space than necessary to display 5 items
+        // we must not make the selected item disappear !
         EnsureVisible(index);
     }

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to