Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2015-07-16 03:49:55 -0400
committerNiraj Modi2015-08-04 10:21:35 -0400
commite93cc9585134967a74c41f976f4fe2ee20bb4c16 (patch)
tree47e1365b70719a93cb360bdc74ad39164d98847a
parentdb5de5a7df9f2212ec75b5a8422aff080983a679 (diff)
downloadeclipse.platform.swt-e93cc9585134967a74c41f976f4fe2ee20bb4c16.tar.gz
eclipse.platform.swt-e93cc9585134967a74c41f976f4fe2ee20bb4c16.tar.xz
eclipse.platform.swt-e93cc9585134967a74c41f976f4fe2ee20bb4c16.zip
Bug 334234 - [Viewers] TableViewer scrolls the leftmost column into view
unexpectedly Change-Id: Ic2e90e1349270c5aed9b6e9816b23febd900e109 Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index ca0c7bbadd..48b7fb221a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -5451,7 +5451,8 @@ void showItem (int index) {
* of visible items is zero and use LVM_ENSUREVISIBLE with the
* fPartialOK flag set to true to scroll the table.
*/
- if (OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0) <= 0) {
+ long /*int*/ counterPage = OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0);
+ if (counterPage <= 0) {
/*
* Bug in Windows. For some reason, LVM_ENSUREVISIBLE can
* scroll one item more or one item less when there is not
@@ -5465,6 +5466,16 @@ void showItem (int index) {
if (index != OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0)) {
OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 1);
}
+ } else if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ /*
+ * Bug in Windows Vista and onwards: For some reason,
+ * LVM_ENSUREVISIBLE command scrolls the table to the leftmost
+ * column even if the item is already visible, refer Bug 334234
+ */
+ long /*int*/ topIndex = OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
+ if (topIndex > index || index >= topIndex + counterPage ) {
+ OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
+ }
} else {
OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
}

Back to the top