Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » html5 placeholder like for SWT
html5 placeholder like for SWT [message #665368] Thu, 14 April 2011 13:01 Go to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi all!
when i open the 'Install new software' window, the field used to filter the plugins has a html5 like placeholder wrote 'type filter text'
how can i do that?
thanks
Re: html5 placeholder like for SWT [message #665539 is a reply to message #665368] Fri, 15 April 2011 02:27 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 276
Registered: July 2009
Location: India
Senior Member
Hi,

You need to use Text.setMessage().
Take a look at this example snippet -- http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet309 .java


Lakshmi P Shanmugam
Re: html5 placeholder like for SWT [message #665559 is a reply to message #665539] Fri, 15 April 2011 05:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
.... but this only works when using SWT.SEARCH!

Tom

Am 15.04.11 04:27, schrieb Lakshmi Shanmugam:
> Hi,
>
> You need to use Text.setMessage().
> Take a look at this example snippet --
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet309 .java
>
Re: html5 placeholder like for SWT [message #665567 is a reply to message #665559] Fri, 15 April 2011 06:22 Go to previous messageGo to next message
Lakshmi ShanmugamFriend
Messages: 276
Registered: July 2009
Location: India
Senior Member
It is used typically used with SWT.SEARCH, but Text.setMessage() works for all Text widgets with SWT.SINGLE style.




Lakshmi P Shanmugam
Re: html5 placeholder like for SWT [message #665645 is a reply to message #665559] Fri, 15 April 2011 11:07 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
i'm using SWT.SEARCH Very Happy
thanks a lot, guys, works perfect now!
Re: html5 placeholder like for SWT [message #665667 is a reply to message #665645] Fri, 15 April 2011 12:39 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
i made a search text widget like this:

package br.com.germantech.widgets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

public abstract class SearchText extends Text implements ModifyListener{

	public SearchText(Composite parent) {
		super(parent, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
		setMessage("Buscar...");
		addModifyListener(this);
	}

	@Override
	public void modifyText(ModifyEvent e) {
		doModify();
	}

	@Override
	protected void checkSubclass() {
		//hacker!
	}
	
	@Override
	protected void checkWidget() {
		//hacker!
	}
	
	public abstract void doModify();
	
}
Re: html5 placeholder like for SWT [message #665679 is a reply to message #665667] Fri, 15 April 2011 12:47 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6566
Registered: July 2009
Senior Member
You should not subclass SWT-Widgets, don't blame anybody if your code
gets broken one day.

Tom

Am 15.04.11 14:39, schrieb luizk:
> i made a search text widget like this:
>
>
> package br.com.germantech.widgets;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.ModifyEvent;
> import org.eclipse.swt.events.ModifyListener;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Text;
>
> public abstract class SearchText extends Text implements ModifyListener{
>
> public SearchText(Composite parent) {
> super(parent, SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
> setMessage("Buscar...");
> addModifyListener(this);
> }
>
> @Override
> public void modifyText(ModifyEvent e) {
> doModify();
> }
>
> @Override
> protected void checkSubclass() {
> //hacker!
> }
>
> @Override
> protected void checkWidget() {
> //hacker!
> }
>
> public abstract void doModify();
>
> }
>
Re: html5 placeholder like for SWT [message #665688 is a reply to message #665679] Fri, 15 April 2011 13:58 Go to previous message
Luiz E. is currently offline Luiz E.Friend
Messages: 100
Registered: September 2010
Senior Member
hi tom!
is there an appropriate way to do the same thing that i've done?
Previous Topic:FileFieldEditor Help
Next Topic:Intransparent shape on an transparent shell
Goto Forum:
  


Current Time: Mon Sep 21 15:15:25 GMT 2020

Powered by FUDForum. Page generated in 0.02320 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top