PDA

View Full Version : Menu (table) touble, please help me understand.



AlCapone
September 3rd, 2006, 11:50 AM
I attempt to create a sub-menu that will present the playlists found in a folder:

I start with finding playlists:



PlayLists = {}

for fa in win.Files ("c:\\*.*") do
if math.band (fa.FileAttributes, win.FILE_ATTRIBUTE_DIRECTORY) == 0 then

if string.find((fa.FileName),".wmv") then
table.insert(PlayLists,(fa.FileName))
end
if string.find((fa.FileName),".pls") then
table.insert(PlayLists,(fa.FileName))
end

end
end


so, now I assume I have a table with filenames...
and now I attempt to insert the new table into the oterwise working menu...






local MusicFeedback ={
Title="Music Feedback",
[1]='Bad File',
[2]='Bad Song',
[3]='Bad Artist',
[4]='Cool Song',
[5]='Wrong Playlist',
[6]=RootMenu,
}

local MovieMenu ={
Title="Movie Menu",
[1]='Start Zoomplayer',
[2]='Close Zoomplayer',
[3]='Toggle Fullscreen',
[4]=RootMenu,

}

local GPSMenu ={
Title="GPS Menu",
[1]='Mapmonkey',
[2]='TTQV',
[3]='MapSonic',
[4]='Close Mapmonkey',
[5]='Close TTQV',
[6]='Close MapSonic',
[7]='Fix TTQV License',
[8]='Configure Mapmonkey',
[9]=RootMenu,

}

local SystemMenu ={
Title="System Menu",
[1]='Toggle Taskbar',
[2]='Toggle OSD Keyboard',
[3]='Aquarium',
[4]='Reboot',
[5]='Hibernate',
[6]='Shutdown',
[7]=RootMenu,

}


MyMenu = {
Title="Root Menu",
[1]='Whats Up',
[2]='Shuffle On/Off',
[3]=PlayLists,
[4]=MusicFeedback,
[5]=MovieMenu,
[6]=GPSMenu,
[7]=SystemMenu,
[8]='Control Audio',
[9]='Control Video',
[10]='Exit',
}


table.insert(MusicFeedback, MyMenu)
table.insert(MovieMenu, MyMenu)
table.insert(GPSMenu, MyMenu)
table.insert(SystemMenu, MyMenu)
table.insert(PlayLists, MyMenu) -- this does not work very well !!






and... it does not work, not at all... strange results in the "variable inspector", seems like some kind of nested menus.

Ron
September 4th, 2006, 09:37 AM
Did you try to add the 'Title="Music Feedback", to the 'PlayLists' table? That might be the missing link...

AlCapone
September 5th, 2006, 03:17 PM
thanks, good try, but it did not work.
I am moving these days, will look more at it in near future.