Delphi get android combobox selected element text

I have a combo box in which there are many elements inside, and I need to enter the name of the selected element into the variable.

var a:string; begin a:=ComboBox1.Text; end; 

So I used the Delphi VCL application and it works. Here I am developing Firemonkey and Android, I do not have the text property.

How can I get the text of the selected item in my combo box?

+4
source share
2 answers

The same thing works in FireMonkey, as in VCL code - use TComboBox.Items . TComboBox.ItemIndex indicates which one is currently selected (or you can set a selection).

Think:

 if ComboBox1.ItemIndex <> -1 then ShowMessage(ComboBox1.Items[ComboBox1.ItemIndex]); 

To install:

 ComboBox1.ItemIndex := 2; 
+5
source

you can access the Selected property to get the text:

  if ComboBox1.ItemIndex >= 0 then ShowMessage(ComboBox1.Selected.Text); 
+6
source

All Articles