Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » masked value for swt text field based on indicator
masked value for swt text field based on indicator [message #759834] Wed, 30 November 2011 04:18 Go to next message
sam mn is currently offline sam mn
Messages: 25
Registered: August 2010
Junior Member
trying to make characters typed into a text into masked ones based on a checkbox indicator.

tried the below code, but it is not working:

valueText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if(maskIndicator.getSelection()){
valueText.setEchoChar('*');
}
}
});

why is echoChar not working??
can someone guide me, what i am doing wrong here.

[Updated on: Wed, 30 November 2011 11:14]

Report message to a moderator

Re: masked value for swt text field based on indicator [message #760124 is a reply to message #759834] Thu, 01 December 2011 06:52 Go to previous messageGo to next message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,

setEchoChar() doesn't work for Text with SWT.MULTI style. Are you using SWT.MULTI or SWT.SINGLE style?

Also, since you are using the echo character based on the checkbox indicator, it is better to set and unset the echo character using setEchoChar() in the checkbox's selection listener.



Lakshmi P Shanmugam
Re: masked value for swt text field based on indicator [message #760340 is a reply to message #760124] Thu, 01 December 2011 20:08 Go to previous messageGo to next message
sam mn is currently offline sam mn
Messages: 25
Registered: August 2010
Junior Member
Thanks for the SWT.Single info Lakshimi.

how do we unset echochar?
Re: masked value for swt text field based on indicator [message #760355 is a reply to message #760340] Fri, 02 December 2011 01:11 Go to previous message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
From javadoc of setEchoChar "...setting the echo character to '\0' clears the echo character and redraws the original text"

Lakshmi P Shanmugam
Previous Topic:StyledText with Image?
Next Topic:How to scroll in this composite with Page-Up/Down?
Goto Forum:
  


Current Time: Sat Jul 26 05:28:10 EDT 2014

Powered by FUDForum. Page generated in 0.01643 seconds