Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Tab order with custom form item

    I´ve just noticed, from my previous post (http://forums.smartclient.com/showthread.php?t=7994), that the custom form item I´ve created is interfering the tab order of the main form.

    See the sample code below. "formPanel" is my main form, which have some items, including my custom form item. Notice that the third component is my custom component.

    Code:
      formPanel = new DynamicForm();
      (...)
      cbTiposAutor = new ComboBoxItem("tipo_autor", "Tipo de autor");		
      cbAutores = new ComboBoxItem("auutores", "Autor");
      cbTiposProposicao = new AlmComboBoxItem("tipo_proposicao", "Tipo de proposição");
      ementa = new TextAreaItem("ementa", "Ementa");
      data = new DateItem("data_entrega", "Data da Entrega");
        
      formPanel.setFields(cbTiposAutor,cbAutores,cbTiposProposicao,ementa, 
          data )
    Just to remember, my custom form item is:

    Code:
    public class AlmComboBoxItem extends CanvasItem {
    
    	DynamicForm form;
    	TextItem tiPesquisar;
    	ComboBoxItem cbListaItens;
    	
    	public AlmComboBoxItem(String name, String title) {
    		super(String name, String title);
    		
    		tiPesquisar = new TextItem("Pesquisar", "pesquisar");
    		tiPesquisar.setShowTitle(false);
    		cbListaItens = new ComboBoxItem("Lista", "lista");
    		cbListaItens.setShowTitle(false);
    		
    		form = new DynamicForm();
    		form.setNumCols(2);
    		form.setItems(tiPesquisar, cbListaItens);
    		
    		this.setCanvas(form);		
    	}
           (...)
    }
    So, the focus goes from cbTiposAutor (first main form item) to the first component of my custom form item (tiPesquisar). Another tab makes the focus go to cbAutores (my second main form item), and another one makes it go to the second component of my custom form item (cbListaItens). After that, focus continues in the expected order.

    Is that the expected behaviour? It seems the fact that my custom item contains a form affects the tab order, don´t? I think it is desired that the tab order would be cbTiposAutor -> cbAutores -> tiPesquisar -> cbListaItens

    [],
    Matheus

    #2
    Nobody knows how to change that tab order in this form with a custom component?

    I know I can change the tab order of each component individually, but it would be good if there is a way to do that automatically, keeping the top-down order components are displayed. Is that the only way actually?

    [],
    Matheus

    Comment


      #3
      Hey,

      2 years later I'm facing the same problem. Have you found a solution for this problem?

      Comment


        #4
        Using GWT 2.3.0 / SmartGWT 3.0

        I also noticed that when I add a CanvasItem with 2 buttons to my form, the tab order is not respected.

        I would expect the tab order to be the order in which I add form items to the form which is:
        1. TextItem #1
        2. PasswordItem #1
        3. TextItem #2
        4. CanvasItem button #1
        5. CanvasItem button #2

        Instead I am seeing this unexpected behavior where the tab order is:
        1. TextItem #1
        2. CanvasItem button #1
        3. PasswordItem #1
        4. CanvasItem button #2
        5. TextItem #2

        I can work on a stand-alone example, but this has always worked this way as far as I can remember...

        I remember using some DynamicForm API to set the tab order, but I remember that not working either.

        If anybody has run into this issue, can you share your solution, or possibly offer your idea for how to deal with this problem?

        Comment


          #5
          Solution:
          http://forums.smartclient.com/showthread.php?t=20579

          Where Isomorphic says: call CanvasItem.setCanFocus (true):
          Code:
                final CanvasItem canvasItem = new CanvasItem ();
                canvasItem.setCanvas (buttonLayout);
                canvasItem.setCanFocus (true);
          Then with both SmartGWT 2.5 and 3.0 I get the expected Tab order...

          Comment

          Working...
          X