Home » Eclipse Projects » Remote Application Platform (RAP) » setMessage Hints with < character(Cannot use < character in setMessage for Text Hints)
setMessage Hints with < character [message #1077925] |
Fri, 02 August 2013 10:18 |
|
If I try to use a Less Than symbol in setMessage for a Text control to give it a Hint, nothing is displayed after the < character.
For example, setMessage("ABC<HELLO>") gives "ABC" as the Hint.
Worse, setMessage("<Be nice to me>") gives a totally blank Hint.
I assume this relates to invalid characters in HTML as rendered by RAP? I can use these types of Hints in SWT, so I assume it is a bug in RAP that it cannot handle them?
Thanks, John
---
Just because you can doesn't mean you should
|
|
| |
Re: setMessage Hints with < character [message #1079925 is a reply to message #1078598] |
Mon, 05 August 2013 08:42 |
|
Hi Ralf,
Sure... here is a snippet:
/* DEMONSTRATES HINT PROBLEM WITH LESS THAN CHARACTERS */
package bug.snippet;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class Bugsy {
private static Display display;
private static Shell shell;
private static Composite comp;
private static Text txt1;
private static Text txt2;
private static Text txt3;
private static Text txt4;
public static void begin() {
System.out.println("BugSnippy Starting...");
FormLayout layout;
FormData fd;
// create Shell
display = new Display();
shell = new Shell(display, SWT.TITLE|SWT.MAX|SWT.MIN|SWT.RESIZE|SWT.CLOSE);
shell.setText("Shell");
shell.setSize(500, 400);
shell.setLocation(20, 20);
shell.setBackground(new Color(null, new RGB(192,128,255)));
layout = new FormLayout();
shell.setLayout(layout);
// create the Composite
comp = new Composite(shell, SWT.BORDER);
fd = new FormData();
fd.left = new FormAttachment(0, 20);
fd.top = new FormAttachment(0, 20);
fd.right = new FormAttachment(100, -20);
fd.bottom = new FormAttachment(100, -20);
comp.setLayoutData(fd);
layout = new FormLayout();
comp.setLayout(layout);
comp.setBackground(new Color(null, new RGB(255,128,192)));
comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
// add Text1 entry field onto Shell
txt1 = new Text(comp, SWT.SINGLE|SWT.BORDER);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(0, 5);
fd.width = 100;
fd.height = 40;
txt1.setLayoutData(fd);
txt1.setMessage("Plain");
// add Text2 entry field onto Shell
txt2 = new Text(comp, SWT.SINGLE|SWT.BORDER);
fd = new FormData();
fd.left = new FormAttachment(0, 5);
fd.top = new FormAttachment(0, 80);
fd.width = 100;
fd.height = 40;
txt2.setLayoutData(fd);
txt2.setMessage("<LessThan");
// add Text3 (read only) entry field onto Shell
txt3 = new Text(comp, SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
fd = new FormData();
fd.left = new FormAttachment(0, 150);
fd.top = new FormAttachment(0, 5);
fd.width = 100;
fd.height = 40;
txt3.setLayoutData(fd);
txt3.setMessage("GreaterThan>");
// add Text4 (read only) entry field onto Shell
txt4 = new Text(comp, SWT.SINGLE|SWT.BORDER|SWT.READ_ONLY);
fd = new FormData();
fd.left = new FormAttachment(0, 150);
fd.top = new FormAttachment(0, 80);
fd.width = 100;
fd.height = 40;
txt4.setLayoutData(fd);
txt4.setMessage("LikeATag");
// set field background colours
txt1.setBackground(new Color(null, new RGB(0,255,0)));
txt2.setBackground(null);
txt3.setBackground(new Color(null, new RGB(0,255,0)));
txt4.setBackground(null);
shell.open();
System.out.println("BugSnippy Done!");
}
}
The text field with the "<LessThan" setMessage does not appear, so you end up with a display like this:
Cheers, John
p.s. sorry about the dodgy colours in the snippet
---
Just because you can doesn't mean you should
[Updated on: Mon, 05 August 2013 08:43] Report message to a moderator
|
|
|
Re: setMessage Hints with &lt; character [message #1080692 is a reply to message #1079925] |
Tue, 06 August 2013 09:14 |
|
Thanks John, now I see it. Nice choice of colors BTW :-P
Actually, I missed that this is about the message, not the text, sorry.
Could you open a bug for it?
Here's a minimal snippet, that can be started directly with the RWT
launcher (Run As... > RWT Application)
public class TextMessageSnippet extends AbstractEntryPoint {
@Override
protected void createContents( Composite parent ) {
parent.setLayout( new GridLayout() );
new Text( parent, SWT.BORDER ).setText( "less<than" );
new Text( parent, SWT.BORDER ).setText( "greater>than" );
new Text( parent, SWT.BORDER ).setMessage( "less<than" );
new Text( parent, SWT.BORDER ).setMessage( "greater>than" );
}
}
Best Regards,
Ralf
--
Ralf Sternberg
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| |
Goto Forum:
Current Time: Fri Apr 26 08:49:45 GMT 2024
Powered by FUDForum. Page generated in 0.02850 seconds
|