Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » html5 placeholder like for SWT
html5 placeholder like for SWT [message #665368] Thu, 14 April 2011 09:01 Go to next message
Eclipse UserFriend
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] Thu, 14 April 2011 22:27 Go to previous messageGo to next message
Eclipse UserFriend
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 #665559 is a reply to message #665539] Fri, 15 April 2011 01:56 Go to previous messageGo to next message
Eclipse UserFriend
.... 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 02:22 Go to previous messageGo to next message
Eclipse UserFriend
It is used typically used with SWT.SEARCH, but Text.setMessage() works for all Text widgets with SWT.SINGLE style.


Re: html5 placeholder like for SWT [message #665645 is a reply to message #665559] Fri, 15 April 2011 07:07 Go to previous messageGo to next message
Eclipse UserFriend
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 08:39 Go to previous messageGo to next message
Eclipse UserFriend
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 08:47 Go to previous messageGo to next message
Eclipse UserFriend
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 09:58 Go to previous message
Eclipse UserFriend
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: Fri Jul 04 11:31:55 EDT 2025

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

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

Back to the top