cancel
Showing results for 
Search instead for 
Did you mean: 

Text selected when InputField has focus

Former Member
0 Kudos

Hi,

I have a Table, which on press enter jump from one InputField to another.

How I could do to when the InputField gets focused, the text inside (a zero, because its an initialized integer) were selected and ready to write?

With this I would like to avoid that user has to delete the zero to write the number he/she wants.

Thanks!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Try

Requests to change the keyboard input focus to this view element.

It is undefined which focus request wins if there are several ones.

The request may silently fail, but is guaranteed not to throw an exception.

If this view element is a table cell editor, its occurence in the current

row (according to the context's lead selection) will receive focus. Similar

things will happen inside other containers that display multiple occurences

of the same view element.

requestFocus();

Ex: IWDTextEdit a;

a.requestFocus()

Regards

Ayyapparaj

Former Member
0 Kudos

Thank you both, but I think you didnt understand my question.

The issue of InputField to get focus was solve before ask my question. I use requestFocus(), like you both says. But now, what I want to do is select the <b>text inside</b> of the InputField or delete this in some way to dont have to delete the zero with the keyboard before insert some number.

Thanks.

Former Member
0 Kudos

Hi ..

you cant remove tht zero by default. Else u can asign tht as string and convert it as integer using Integer.parstInt...

GS

Former Member
0 Kudos

Thanks.

In my opinion, that solution isnt very elegant.

Any idea about selecting the text?

Former Member
0 Kudos

Sorry .. I don have any idea..

Former Member
0 Kudos

Hi...

Use the following the code:

if(firsttime)

{

// get the UI element you want to focus In this case i am taking a input field

IWDInputfield inputfield = (IWDInputfield)view.getElement("<UI element ID>");

inputfield.requestFocus();

I think you cant remove tht zero if u set the property as interger

GS

Message was edited by:

Sathishkumar GS