prob getting table to combobox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Jonas DK
    Indigo Rose Customer
    • Jul 2004
    • 345

    prob getting table to combobox

    Having some trouble populating a ComboBox with a Table, maybe someone can spot the error. I keep getting an error message saying "Attempt to call Global 'tEnhed' (a table value)"

    This is the code I have:

    On app Startup:
    Code:
    --**********     Create constant Tables START     **********--
    tEnhed = {"Bæver", "Ulv-Toomai", "Ulv-Seeonee", "Junior", "Spejder", "Senior", "Rover", "Leder"};
    On Page OnShow:
    Code:
    --**********     Make sure all fields are empty START     **********--
    ComboBox.DeleteItem("cbEnhed", -1);
    Input.SetText("ipAdresse", "");
    Input.SetText("ipPostnr", "");
    Input.SetText("ipCpr", "");
    Input.SetText("ipIndmeldt", "");
    Input.SetText("ipEfternavn", "");
    Input.SetText("ipFornavn", "");
    Label.SetText("lbCity", "By");
    --**********     Make sure all fields are empty END     **********--
    --Used dialog to make sure the data is in the table
    --  result = Table.Concat(tEnhed, ";", 1, TABLE_ALL);
    --  Dialog.Message("Notice", result, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    
    --**********     Read Constant tables to fields START     **********--
    
    -- Prevent the ComboBox from updating
    	ComboBox.SetUpdate("cbEnhed", false);
    
    -- Add Table to ComboBox
    	nEnhed = Table.Count(tEnhed);
    min = 1;  -- The number to start at
    max = nEnhed;  -- The number to stop at 
    for count = min, max do
    local cEnhed = tEnhed(count);
    Dialog.Message("Notice", cEnhed, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    	--ComboBox.AddItem("cbEnhed", cEnhed, count);
    end
    	ComboBox.SetUpdate("cbEnhed", true);
    I thourght it could have something to do with the table so I tried to take the data from the table and pass it to a string that would then be parsed to the combobox but I get the same error, now its just on the string in stead..

    What am I doing wrong?

    Cheers,
    Jonas
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1791

    #2
    Try this

    Code:
    local cEnhed = tEnhed[COLOR="Red"][[/COLOR]count[COLOR="Red"]][/COLOR];
    Dermot

    I am so out of here :yes

    Comment

    • Jonas DK
      Indigo Rose Customer
      • Jul 2004
      • 345

      #3
      of course... I have been looking at this for over an hour trying to get what the error was... and it is so simple...


      Thanks



      Jonas

      Comment

      Working...
      X