Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2006-09-14 21:24:00 +0000
committerSteve Northover2006-09-14 21:24:00 +0000
commit761b02160dd985a7eec0caf5008cafd33224c549 (patch)
tree4adcf764bfb2d756c5bb7cdd3bc8f2100ce10c6c
parent91655b5530a0c72a2ccc7e30d2b83d46cffe66d6 (diff)
downloadeclipse.platform.swt-761b02160dd985a7eec0caf5008cafd33224c549.tar.gz
eclipse.platform.swt-761b02160dd985a7eec0caf5008cafd33224c549.tar.xz
eclipse.platform.swt-761b02160dd985a7eec0caf5008cafd33224c549.zip
155801 - Table column tooltip disappears after scrolling
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java65
1 files changed, 50 insertions, 15 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 d01e81b936..57686d13af 100755
--- 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
@@ -2202,6 +2202,16 @@ public int getTopIndex () {
return Math.max (0, OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0));
}
+boolean hasChildren () {
+ int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
+ int hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
+ while (hwndChild != 0) {
+ if (hwndChild != hwndHeader) return true;
+ hwndChild = OS.GetWindow (hwndChild, OS.GW_HWNDNEXT);
+ }
+ return false;
+}
+
int imageIndex (Image image) {
if (image == null) return OS.I_IMAGENONE;
if (imageList == null) {
@@ -4618,13 +4628,23 @@ LRESULT WM_KEYDOWN (int wParam, int lParam) {
* so that internal messages are dispatched directly to the table.
* If the application expects to see a paint event, the window
* proc cannot be unsubclassed or the event will not be seen.
+ *
+ * NOTE: The header tooltip can subclass the header proc so the
+ * current proc must be restored or header tooltips stop working.
*/
- if (!hooks (SWT.Paint) && !filters (SWT.Paint)) {
- unsubclass ();
+ int oldHeaderProc = 0, oldTableProc = 0;
+ int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
+ boolean fixSubclass = !hasChildren () && !hooks (SWT.Paint) && !filters (SWT.Paint);
+ if (fixSubclass) {
+ oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc);
+ oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc);
}
int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
result = code == 0 ? LRESULT.ZERO : new LRESULT (code);
- subclass ();
+ if (fixSubclass) {
+ OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldTableProc);
+ OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, oldHeaderProc);
+ }
//FALL THROUGH
case OS.VK_UP:
case OS.VK_DOWN:
@@ -5124,15 +5144,23 @@ LRESULT WM_HSCROLL (int wParam, int lParam) {
* so that internal messages are dispatched directly to the table.
* If the application expects to see a paint event or has a child
* whose font, foreground or background color might be needed,
- * the window proc cannot be unsubclassed.
+ * the window proc cannot be unsubclassed
+ *
+ * NOTE: The header tooltip can subclass the header proc so the
+ * current proc must be restored or header tooltips stop working.
*/
- if (OS.GetWindow (handle, OS.GW_CHILD) == 0) {
- if (!hooks (SWT.Paint) && !filters (SWT.Paint)) {
- unsubclass ();
- }
+ int oldHeaderProc = 0, oldTableProc = 0;
+ int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
+ boolean fixSubclass = !hasChildren () && !hooks (SWT.Paint) && !filters (SWT.Paint);
+ if (fixSubclass) {
+ oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc);
+ oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc);
}
LRESULT result = super.WM_HSCROLL (wParam, lParam);
- subclass ();
+ if (fixSubclass) {
+ OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldTableProc);
+ OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, oldHeaderProc);
+ }
/*
* Bug in Windows. When a table that is drawing grid lines
@@ -5165,14 +5193,22 @@ LRESULT WM_VSCROLL (int wParam, int lParam) {
* If the application expects to see a paint event or has a child
* whose font, foreground or background color might be needed,
* the window proc cannot be unsubclassed.
+ *
+ * NOTE: The header tooltip can subclass the header proc so the
+ * current proc must be restored or header tooltips stop working.
*/
- if (OS.GetWindow (handle, OS.GW_CHILD) == 0) {
- if (!hooks (SWT.Paint) && !filters (SWT.Paint)) {
- unsubclass ();
- }
+ int oldHeaderProc = 0, oldTableProc = 0;
+ int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
+ boolean fixSubclass = !hasChildren () && !hooks (SWT.Paint) && !filters (SWT.Paint);
+ if (fixSubclass) {
+ oldTableProc = OS.SetWindowLong (handle, OS.GWL_WNDPROC, TableProc);
+ oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc);
}
LRESULT result = super.WM_VSCROLL (wParam, lParam);
- subclass ();
+ if (fixSubclass) {
+ OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldTableProc);
+ OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, oldHeaderProc);
+ }
/*
* Bug in Windows. When a table is drawing grid lines and the
@@ -5193,7 +5229,6 @@ LRESULT WM_VSCROLL (int wParam, int lParam) {
case OS.SB_LINEDOWN:
case OS.SB_LINEUP:
int headerHeight = 0;
- int hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
if (hwndHeader != 0) {
RECT rect = new RECT ();
OS.GetWindowRect (hwndHeader, rect);

Back to the top