Reply To: popup menu actions? (how?)

Home Forums General Programming popup menu actions? (how?) Reply To: popup menu actions? (how?)

#72841
human fly
Participant
  • Topics: 124
  • Replies: 1070
  • Total: 1194
  • ★★★★

hi – ok, i’ve reproduced your code, and i’m getting this error
(what do we call this type of error? syntax?)

At line [-1]: [C]
What: C
Namewhat: method
Name: addColouredItem
Error message: No matching overload found, candidates:
void addColouredItem(PopupMenu&,int,String const&,Colour,bool,bool,Image const&)
void addColouredItem(PopupMenu&,int,String const&,Colour,bool,bool,Drawable*)

am i correct in thinking it is failing at ‘image()’?
here is what my copy of your code looks like:

function colourPop2()

	--This stops issues during panel bootup--else popup will hang startup!
	if panel:getRestoreState() == true or panel:getProgramState() == true 
	then return end

-- Create a table for menu item names
	itemNames = 
	{
	"toneName1","toneName2","toneName3","toneName4","toneName5","toneName6","toneName7","toneName8",
	"toneName9","toneName10",
	}
--
	local pMenu	= PopupMenu()

-- Create menu items from the "itemNames" table
	for i=1, #itemNames do
	pMenu:addColouredItem(i, itemNames, Colour(0xff21c630), true, false, Image())
	end
--
	local ret = pMenu:show(0,0,0,0)

--////////////////////////////////////// MENU ACTIONS /////////////////////////////
-- Return if nothing is selected
	if ret == 0 then 
	return
	end

-- Print the correct name from the "itemNames" table
-- Here you could send the name to a label
	console(itemNames[ret])
end
Ctrlr