AutoPlay Media Studio 9

ComboBox.SetItemData

ComboBox.SetItemData

This is the first topic This is the last topic  

ComboBox.SetItemData

This is the first topic This is the last topic  

OverviewExamples

ComboBox.SetItemData (

string ObjectName,

number Index,

string Data )

Example 1

-- Adds a new item with item text "Item One" and associated data "C:\\One.txt"

-- to the combobox object called "ComboBox1".

ComboBox.AddItem("ComboBox1", "Item One", "C:\\One.txt");-- Check to see if any errors occurred calling the ComboBox.AddItem action.

 

-- If any error occurred, display the error message.

error = Application.GetLastError();

if (error ~= 0) then

  Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION,MB_DEFBUTTON1);

end

 

-- Gets the item data of the first item in the combobox object.

item_data = ComboBox.GetItemData("ComboBox1", 1);

 

-- If the item has item data, display its contents, otherwise notify that there was none.

if (item_data ~= "") then

  Dialog.Message("Item Data", "The item data in index 1 is "..item_data, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

else

  Dialog.Message("Item Data", "There is no item data at index 1.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

end

 

-- Set the item data of the item at index 1 to "New Data".

ComboBox.SetItemData("ComboBox1", 1, "New Data");

 

-- Check to see if any errors occurred calling the ComboBox.SetItemData action.

-- If any error occurred, display the error message.

error = Application.GetLastError();

if (error ~= 0) then

  Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

end

 

-- Gets the item data of the first item in the combobox object.

item_data = ComboBox.GetItemData("ComboBox1", 1);

 

-- If the item has item data, display its contents, otherwise notify that there was none.

if (item_data ~= "") then

  Dialog.Message("New Item Data", "The new item data in index 1 is "..item_data, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

else

  Dialog.Message("Item Data", "There is no item data at index 1.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

end

Adds an item to the combobox object "ComboBox1" and manipulates the item's data.

See also: Related Actions


Learn More: Indigo Rose Software - AutoPlay Media Studio - Buy Now - Contact Us