PDA

View Full Version : combobox and input


luffymk
10-07-2007, 01:58 PM
http://s1.subirimagenes.com/imagenes/previo/thump_15041102007-10-07_145212.gif

as I can, "ComboBox" when selecting shows in “input1”

my code:

Page1
On Show

if ComboBox.ItemIndex ~= -0 then
ComboBox.AddItem("ComboBox1", "opcion 1");
ComboBox.AddItem("ComboBox1", "opcion 2");
end

Button 1
On Click
Input.SetText("Input1", ComboBox);

I have error when it makes the call ComboBox to input

http://s1.subirimagenes.com/imagenes/previo/thump_15041202007-10-07_145244.gif

thus deberia of being
http://s1.subirimagenes.com/imagenes/previo/thump_15041312007-10-07_145717.gif

fmwyso
10-07-2007, 02:48 PM
I don't know if i misunderstood you or not, but you can't just have it set the text as ComboBox.

This is the code for the button...

-- This checks if the combobox is selected or not.
tSelected = ComboBox.GetSelected("ComboBox1")

-- This is if something is selected, then it gets the text
-- and then places it in the input box.
if tSelected then
tComboBox = ComboBox.GetItemText("ComboBox1", tSelected)
Input.SetText("Input1", tComboBox)
end

--- My project is below if you need any help from it. I hope i helped you with your error ^_^.

longedge
10-07-2007, 02:57 PM
I don't undertand exactly what you are saying but try -

In the on show (you can add data for each option) -
if ComboBox.ItemIndex ~= -0 then
ComboBox.AddItem("ComboBox1", "opcion 1", "The data for option1");
ComboBox.AddItem("ComboBox1", "opcion 2", "The data for option2");
end

In the button on click -
comboselected = ComboBox.GetSelected("ComboBox1");
combodata = ComboBox.GetItemData("ComboBox1", comboselected);
Input.SetText("Input1", comboselected);
-- or to display the data part of the selected item
-- Input.SetText("Input1", combodata);