Forum /
Ext GWT Community Forums (2.x) /
Ext GWT: Discussion /
Set Focus on a TextField within a FormPanel
Set Focus on a TextField within a FormPanel
I actually decides to open a thread about this argument, since i experienced it is not working as i imagined,and read many post about this but found no clear solution.
The problem statement is quite simple:
Have a form panel and Fields within it, how can i set the focus onto a field?
The next two simple code does not do the job:
1)
TextField tf = new TextField<String>();
Button button = new Button("focus on textfield");
button.addSelectionListener(new SelectionListener<ButtonEvent>(){
@Override
public void componentSelected(ButtonEvent ce) {
tf.setFocus();
}
});
2)
TextField tf = new TextField<String>();
Window window = new Window();
window.add(tf);
window.setFocusWidget(tf);
What am i doing wrong?
if you textfield is into a panel just:
component.focus();
if your component is on a Window use
setFocusWidget(component);
liondev, thanks for the reply,
but if you notice the piece of code i wrote,
i used both commands, and it doesn't work! That's the problem
Originally Posted by
liondev
if you textfield is into a panel just:
component.focus();
if your component is on a Window use
setFocusWidget(component);
try: make your own class extends from Window or ContenPanel
in the constructor add the components u will need.
then focus it
that works for me
Similar Threads
By jyothsna in forum Ext GWT: Discussion
Replies: 8
Last Post: 10 Jun 2012, 9:55 PM
By kevin-berry in forum Ext 3.x: Help & Discussion
Replies: 0
Last Post: 23 May 2010, 10:47 AM
By yanfa01 in forum Ext GWT: Discussion
Replies: 2
Last Post: 6 May 2010, 12:23 AM
By archmisha in forum Ext 2.x: Help & Discussion
Replies: 2
Last Post: 25 Feb 2009, 10:54 AM
By c.mallwitz in forum Ext GWT: Help & Discussion (1.x)
Replies: 0
Last Post: 27 Nov 2008, 1:16 PM
Tags for this Thread
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us