View Full Version : How can I made listbox
mohamed
01-14-2007, 08:34 AM
I hope to made a listbox that do the flowing items
Item Name Item Data
song1 Directory = CD_Root\AutoPlay\Audio\File Name
song2 Directory = CD_Root\AutoPlay\Audio\File Name
song3 Directory = CD_Root\AutoPlay\Audio\File Name
and so on
when I click song1 it's play audio with song1
when I click song2 it's play audio with song2
Please Help me to made this code
Thanks
el5ateer
01-14-2007, 08:59 AM
Check this topic .. Will help you a lot :
http://www.indigorose.com/forums/showthread.php?t=7485
fossil
01-14-2007, 09:20 AM
maybe this will help !
Button : On Click
-- Display a folder browse dialog
sDirectory = Dialog.FolderBrowse("Please select a folder containing the music files you wish to add to the ListBox", "");
-- Ensure the user did not press cancel
if sDirectory ~= 'CANCEL' then
-- Find all the files in the directory
tFiles = File.Find(sDirectory, "*.mp3", false, false, nil);
-- If tFiles contains something
if tFiles then
-- Traverse the table containing the selected file paths
for nIndex, sFilePath in tFiles do
-- Assign the desired text and data to variables
sData = sFilePath;
-- Set sText to the filename (without extension) using String.SplitPath
sText = String.SplitPath(sFilePath).Filename;
-- Add the item to the ListBox
ListBox.AddItem("ListBox1", sText, sData);
end
end
end
Listbox : On Select
tSelected = ListBox.GetSelected("ListBox1");
sData = ListBox.GetItemData("ListBox1", tSelected[1]);
MediaPlayer.Load("Plugin2", sData)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.