Custom Parameters from a table

Hi guys

I’m trying to add custom parameters to a container, I was wondering if it is possible to add a menu parameter that gets all the menuNames and menuLabels automatically from a table. I was trying with the menuSource field but I can only get the parameters from another OP… I know I can watch the table and add parameters when the table changes but I don’t know if there is an easier and more direct way to do that.

Thanks in advance!

I think what you’re after is here:

viewtopic.php?f=17&t=8502&p=32243&hilit=menu+from+table#p32243

Thanks!, that’s exactly what I was looking for :slight_smile:

How would I delete a menu item (Name, Label) from a menu after it has been created using menuSource ?

What I wanted to do was create a new menu based on the serial port menu, deleting some entries that wouldn’t be needed in the new menu. Here is the code (thanks Greg !):

# get serial port menu names and labels
menuNamesSource = serial.par.port.menuNames
menuLabelsSource = serial.par.port.menuLabels
		
# create new menu
menuNames = []
menuLabels = []

for i in range(0, len(menuNamesSource)) :
		
	# if 'SLAB' or 'Dig' string is found in the names
	if ('SLAB' in menuNamesSource[i] or 'Dig' in menuNamesSource[i]) :
			
		# add these names and labels to the new menu
		menuNames.append(menuNamesSource[i])
		menuLabels.append(menuLabelsSource[i])
		
# store new menu as iCube port menu custom parameter
parent().par.Port.menuNames = menuNames
parent().par.Port.menuLabels = menuLabels