Combobox in firemonkey without using FDQuery

1

I have a combobox of states in my register, where I connect via livebindings with an FDMemTable to save the data in the database. How could I get the index item of the selected item in the combo?

The only bidirectional binding I found was SelectedValue, only it returns the string of the item and I need the index.

I do not want to load my combo from an FDQuery or FDMemTable

I'm using the following code:

ACombo.Items.AddObject(GetPropValue(FListaCombo.Items[I], FCampoDescricao), FListaCombo.Items[I]);

I use RAD Studio XE 10.2

Edited:

Note: My project is in firemonkey (FMX)

The ItemIndex generates a one-way link

    
asked by anonymous 13.04.2018 / 20:37

1 answer

2

If it returns the Item String, use the native function of class TStrings .

Ex: ComboBoxX.Items.IndexOf('o_que_ele_retornou_string');

See internal documentation for the IDE: TStrings - > IndexOf .

Obs. If the String appears more than once in the List, it returns the index of the first!

Edit.

For manual binding, you should keep in mind that binding does not have all properties, you must select the component in the LiveBindingis Design window and press CTRL + N and check the desired property!

    
13.04.2018 / 21:07