Question

In a flex table 3 widgets are added in a row at run time .

The first 2 widgets are ListBox and the 3rd widget can be a listBox or a textBox.

I want to know about the third widjet is listBox or textBox??

my code to know about the first 2 widgets

int count=flexTable.getRowCount();
        for(int i =0;i<count;i++){

            ListBox lbPropreties = (ListBox) flexTable.getWidget(i, 0);
            String propertyname =lbPropreties.getValue(lbPropreties.getSelectedIndex());
            ListBox lbCondition = (ListBox) flexTable.getWidget(i, 1);
            String condition =lbCondition.getValue(lbCondition.getSelectedIndex());





        }

Thank you

Was it helpful?

Solution

Easy solution:

Widget thirdWidget = flexTable.getWidget(i, 2);

if (thirdWidget instanceof ListBox) {
  ListBox listBox = (ListBox) thirdWidget;
  ...

} else if (thirdWidget instanceof TextBox) {
  TextBox textBox = (TextBox) thirdWidget;
  ...
}

Alternatively, use some variable to store, which kind of widget you used when adding the third column.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top