hassine
hassine

Reputation: 23

CodeName One about lists

I have a problem I want to use the list and when I click on a component of the list it take me to another form (make an action) meaning if I click on an item from the list depending on the selected index it takes me to another form.

Upvotes: 1

Views: 201

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

Is this in a GUI builder app or manual app?

For GUI builder use the action event callback for the list see: http://www.codenameone.com/how-do-i---handle-eventsnavigation-in-the-gui-builder--populate-the-form-from-code.html

Then get the index/selected item using:

int index = list.getSelectedIndex();
Object value = list.getSelectedItem();

Then you can show the form you want using:

showForm("FormName", null);

In handcoded apps you can get the selected item/index in exactly the same way then do something like:

form.show();

To show a specific form.

Upvotes: 1

Related Questions