Announcement

Collapse
No announcement yet.

Dialog.Combobox, need help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dialog.Combobox, need help

    Hello.
    Help modify this script so that when you select Apple, other text is displayed, for example 1, when Orange is selected, 2 is displayed, and when Pear is selected, 3 is displayed.
    Code:
    -- The combo box items table.
    tbItems = {"Apple", "Orange", "Pear"};
    
    -- Show the dialog combo box.
    strSelected = Dialog.ComboBox("Select Lunch","Please select the desired fruit:",tbItems,"Apple",false,false,MB_ICONQUESTION);
    
    if ((strSelected ~= "") and (strSelected ~= "CANCEL")) then
    Dialog.Message("Result", "The chosen fruit is "..strSelected);
    end

  • #2
    I try this, but when i choose Apple, result is 2, and when choose others, result 1.
    Code:
    if ((strSelected ~= "Apple") and (strSelected ~= "CANCEL")) then
    Dialog.Message("Result", "The chosen fruit is 1");
    elseif ((strSelected ~= "Orange") and (strSelected ~= "CANCEL")) then
    Dialog.Message("Result", "The chosen fruit is 2");
    elseif ((strSelected ~= "Pear") and (strSelected ~= "CANCEL")) then
    Dialog.Message("Result", "The chosen fruit is 3");
    elseif ((strSelected ~= "Bananas") and (strSelected ~= "CANCEL")) then
    Dialog.Message("Result", "The chosen fruit is 4");
    end

    Comment


    • #3
      I figured it out myself, instead of ~ put =.

      Comment

      Working...
      X