Skip to content

Commit dd05f31

Browse files
author
Felipe Heidrich
committed
82739
1 parent 59b2491 commit dd05f31

File tree

1 file changed

+26
-16
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+26
-16
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class Table extends Composite {
4646
TableColumn [] columns;
4747
ImageList imageList;
4848
int lastIndexOf, lastWidth;
49-
boolean customDraw, dragStarted, fixScrollWidth, mouseDown;
49+
boolean customDraw, dragStarted, fixScrollWidth, mouseDown, tipRequested;
5050
boolean ignoreActivate, ignoreSelect, ignoreShrink, ignoreRedraw, ignoreResize;
5151
static final int INSET = 4;
5252
static final int GRID_WIDTH = 1;
@@ -629,7 +629,7 @@ void createItem (TableColumn column, int index) {
629629
item.strings = new String [columnCount];
630630
item.strings [1] = item.text;
631631
}
632-
item.text = "";
632+
item.text = ""; //$NON-NLS-1$
633633
if (images == null) {
634634
item.images = new Image [columnCount];
635635
item.images [1] = item.image;
@@ -956,14 +956,14 @@ void destroyItem (TableColumn column) {
956956
if (item.strings != null) {
957957
String [] strings = item.strings;
958958
if (index == 0) {
959-
item.text = strings [1] != null ? strings [1] : "";
959+
item.text = strings [1] != null ? strings [1] : ""; //$NON-NLS-1$
960960
}
961961
String [] temp = new String [columnCount];
962962
System.arraycopy (strings, 0, temp, 0, index);
963963
System.arraycopy (strings, index + 1, temp, index, columnCount - index);
964964
item.strings = temp;
965965
} else {
966-
if (index == 0) item.text = "";
966+
if (index == 0) item.text = ""; //$NON-NLS-1$
967967
}
968968
if (item.images != null) {
969969
Image [] images = item.images;
@@ -3218,7 +3218,18 @@ LRESULT WM_NOTIFY (int wParam, int lParam) {
32183218
}
32193219
}
32203220
}
3221-
return super.WM_NOTIFY (wParam, lParam);
3221+
LRESULT result = super.WM_NOTIFY (wParam, lParam);
3222+
if (result != null) return result;
3223+
switch (hdr.code) {
3224+
case OS.TTN_GETDISPINFOA:
3225+
case OS.TTN_GETDISPINFOW: {
3226+
tipRequested = true;
3227+
int code = callWindowProc (handle, OS.WM_NOTIFY, wParam, lParam);
3228+
tipRequested = false;
3229+
return new LRESULT (code);
3230+
}
3231+
}
3232+
return result;
32223233
}
32233234

32243235
LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
@@ -3419,24 +3430,23 @@ LRESULT wmNotifyChild (int wParam, int lParam) {
34193430
* is not reset. This means that when the text for the
34203431
* item is set and then reset to an empty string, the
34213432
* selection draws using the bounds of the previous text.
3422-
* The fix is to assign a NULL pointer to pszText rather
3423-
* than a pointer to a zero length string.
3433+
* The fix is to use a space rather than an empty string
3434+
* when anything but a tool tip is requested (to avoid
3435+
* a tool tip that is a single space).
34243436
*
34253437
* NOTE: This is only a problem for items in the first
34263438
* column. Assigning NULL to other columns stops Windows
34273439
* from drawing the selection when LVS_EX_FULLROWSELECT
34283440
* is set.
34293441
*/
3430-
if (string.length () == 0 && plvfi.iSubItem == 0) {
3431-
plvfi.pszText = 0;
3432-
plvfi.cchTextMax = 0;
3433-
} else {
3434-
TCHAR buffer = new TCHAR (getCodePage (), string, false);
3435-
int byteCount = Math.min (buffer.length (), plvfi.cchTextMax - 1) * TCHAR.sizeof;
3436-
OS.MoveMemory (plvfi.pszText, buffer, byteCount);
3437-
OS.MoveMemory (plvfi.pszText + byteCount, new byte [TCHAR.sizeof], TCHAR.sizeof);
3438-
plvfi.cchTextMax = Math.min (plvfi.cchTextMax, string.length () + 1);
3442+
if (!tipRequested && string.length () == 0 && plvfi.iSubItem == 0) {
3443+
string = " "; //$NON-NLS-1$
34393444
}
3445+
TCHAR buffer = new TCHAR (getCodePage (), string, false);
3446+
int byteCount = Math.min (buffer.length (), plvfi.cchTextMax - 1) * TCHAR.sizeof;
3447+
OS.MoveMemory (plvfi.pszText, buffer, byteCount);
3448+
OS.MoveMemory (plvfi.pszText + byteCount, new byte [TCHAR.sizeof], TCHAR.sizeof);
3449+
plvfi.cchTextMax = Math.min (plvfi.cchTextMax, string.length () + 1);
34403450
}
34413451
}
34423452
if ((plvfi.mask & OS.LVIF_IMAGE) != 0) {

0 commit comments

Comments
 (0)