1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    miroslaw is on a distinguished road

      0  

    Default can't set focus in text field placed in TabItem when tab is selected

    can't set focus in text field placed in TabItem when tab is selected


    It's EXT GWT 2.0 and not Ext JS , Sorry bad thread!

    I have a window with a TabPanel and 2 TabItems. In the second TabItem I have some text fields and I want that when the second TabItem is selected to place the focus in a first text field.

    I Listen to the "show" event on the TabItem, but the focus is set only first time (if tab is selected) .
    If I toggle tabs and select the secondary tab again the focus doesn't work again.

    Please help why i can set the focus on TextField in TabItem, more than once!

    The source is:
    public void onModuleLoad() {
    LayoutContainer lc = new LayoutContainer();
    lc.setLayout( new FlowLayout());

    final TabItem ti1 = new TabItem("Tab 1");
    final TabItem ti2 = new TabItem("Tab 2");

    final TextField<String> tf1 = new TextField<String>();
    ti1.add(tf1);
    final TextField<String> tf2 = new TextField<String>();
    ti1.add(tf2);

    final TextField<String> tf3 = new TextField<String>();
    ti2.add(tf3);
    final TextField<String> tf4 = new TextField<String>();
    ti2.add(tf4);

    final TabPanel tp = new TabPanel();
    tp.add(ti1);
    tp.add(ti2);

    ti1.addListener(Events.Show, new Listener<BaseEvent>() {
    @Override
    public void handleEvent(BaseEvent be) {
    tf1.focus();
    }
    });

    ti2.addListener(Events.Show, new Listener<BaseEvent>() {
    @Override
    public void handleEvent(BaseEvent be) {
    tf4.focus();
    }
    });

    tp.setSize(300,300);

    lc.add(tp);

    RootPanel.get().add(lc);

    StateManager.get().set(GWT.getModuleBaseURL() + "theme", "");
    }
    Last edited by miroslaw; 13 Apr 2011 at 11:08 PM. Reason: EXT GWT 2.0 question

Similar Threads

  1. Focus on text Field
    By rehanazher in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 28 Nov 2013, 11:00 PM
  2. ComboBox selected value not set when changing field focus
    By spotk in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 24 Nov 2008, 11:10 PM
  3. do not select existing text in text field when focus via tab key
    By mjlecomte in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 13 Jul 2008, 6:23 PM
  4. Text field focus
    By Zakaroonikov in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Apr 2008, 1:17 PM

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar