Community
Participate
Working Groups
Message dialogs use labels with the SWT.WRAP style to display the message, which causes the label to be created with the SS_EDITCONTROL style flag: Label.java (#widgetStyle()): if (OS.WIN32_VERSION >= OS.VERSION (5, 0)) { if ((style & SWT.WRAP) != 0) bits |= OS.SS_EDITCONTROL; } I wanted to format Message dialog text into columns using tab characters (\t), using GC#textExtent() to figure out how many tab characters to insert to reach a particular column. This approach failed, however, because it proved to be impossible to correctly work out the extent of a string containing one or more tab characters. Reason: The SS_EDITCONTROL style flag alters the tab spacings! For example, for 8pt Tahoma (the default), the tab spacing within a label widget was 48 with SS_EDITCONTROL set, but only 40 without. To obtain the correct text extents in the former case, it would be necessary for GC#textExtent() to call DrawText() with the DT_EDITCONTROL flag set, which is unfortunately not one of the supported DT_* flags (see snippet below): GC.java (#textExtent(String, int)): int uFormat = OS.DT_LEFT | OS.DT_CALCRECT; if ((flags & SWT.DRAW_DELIMITER) == 0) uFormat |= OS.DT_SINGLELINE; if ((flags & SWT.DRAW_TAB) != 0) uFormat |= OS.DT_EXPANDTABS; if ((flags & SWT.DRAW_MNEMONIC) == 0) uFormat |= OS.DT_NOPREFIX; OS.DrawText(handle, buffer, buffer.length(), rect, uFormat); Analogously to the code in Label.java (see above), I was expecting to be able to indirectly set the DT_EDITCONTROL flag by calling #textExtent() with the SWT.WRAP flag: if ((flags & SWT.WRAP) != 0) uFormat |= OS.DT_EDITCONTROL; Could this line be added in to the source code base?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag.