Community
Participate
Working Groups
Build Identifier: 20090920-1017 Currently Text.setMessage("enter remarks") has no effect for multi line text fields. One use case for SWT.setMessage (which has nothing to do with SWT.SEARCH): a multi-line textfield for remarks which shows "enter remarks" in gray when it is empty. Reproducible: Always
Created attachment 276951 [details] Snippet showing this.
Created attachment 276952 [details] FloatingText Widget This is a composite that does show the message on SWT.MULTI in some situations.
Created attachment 276953 [details] Snippet for the FloatingText composite When using this Snippet that uses the FloatingText composite which is also attached you can see that SWT.MULTI does show a message in some situations.
Created attachment 276954 [details] Demonstration of SWT.MULTI showing in FloatingText In this movie, you can see that the middle widget does not show a message but the bottom widget does and they are both SWT.MULTI.
The difference in behavior in the FloatingTextSnippet is caused by a bug in FloatingText in line 113 in the attachment: SWT.SEPARATOR == SWT.MULTI. (See also [1].) The bottom "multi" field is not a multi-line field; it's a single line field that just grabs the remaining space. Try entering a second line there :-) The middle one is a multi-line field. FloatingText by mistake removes the SWT.MULTI when it clears the SWT.SEPARATOR flag, but Text re-adds SWT.MULTI because SWT.WRAP is set. The original report from comment 0 is still correct, though: setMessage() works only for single-line fields (I checked only OS X). However, at least on Cocoa, the implementation class for mutli-line text fields, NSTextView, does not have that concept. It would need to be emulated, but that'd be departing from the SWT concept of being as close as possible to native widgets. [1] https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/172920/4/bundles/org.eclipse.jface.widgets/src/org/eclipse/jface/widgets/floatingtext/FloatingText.java#126
https://bugs.openjdk.java.net/browse/JMC-7298