Dynamic Properties not passed in Jython scripts?

Alright, i am having an issue with some properties nto passing through in a jython scripts. Non dynamic properties, such as name work. But in my case, dynamic properties, such as Tag, do not.

Here is my code

[code]def tx(event):
import fpmi
from app.nav import showFiles, openWiki
from app.ctg import addGraphPoint, deleteGraphPoint,clearGraphPoints
print event,event.source.Tag
roles = fpmi.security.getRoles()
if “Operator” in roles or “Programmer” in roles or “Engineer” in roles:
if event.button == event.BUTTON1:
fpmi.nav.openWindow(‘Transmitter’, {‘Tag’ : event.source.Tag})
fpmi.nav.centerWindow(‘Transmitter’)

	if event.button == event.BUTTON3:
		menuNames = []
		menuFunctions = []

		menuNames.append("<html>Wiki")
		menuFunctions.append(openWiki)

		menuNames.append("<html>Files")
		menuFunctions.append(showFiles)
		
		cid = fpmi.system.getClientId()	
		add_del = fpmi.db.runScalarQuery("select 1 from ctg_active_client where pointID='%s' and client_ID='%s'"%(event.source.Tag,cid))

		if add_del:
			def delFromGraph(event):
				import app
				app.ctg.deleteGraphPoint(event.source.Tag)

			menuNames.append("<html>(-) Delete to Graph")
			menuFunctions.append(delFromGraph)
		else:
			def addToGraph(event):
				import app
				print event, event.source.name
				print event.source.Tag
				app.ctg.addGraphPoint(event.source.Tag)

			menuNames.append("<html>(+) Add to Graph")
			menuFunctions.append(addToGraph)
		
		active = fpmi.db.runScalarQuery("select 1 from ctg_active_client where client_ID = '%s'" %cid)
		if active:	
			menuNames.append("sep")
			menuFunctions.append(None)

			def clearGraph(event):
				import app
				app.ctg.clearGraphPoints()

			menuNames.append("Clear Current Graph")
			menuFunctions.append(clearGraph)
		print event,event.source.Tag
		def showPopup(event = event, menuNames = menuNames, menuFunctions = menuFunctions):
			import fpmi
			menu = fpmi.gui.createPopupMenu(menuNames, menuFunctions)
			menu.show(event,event.x,event.y)
		fpmi.system.invokeLater(showPopup)[/code]

All “print” calls return the event.source.Tag properly, but the print inside the addToGraph function return the event, and event,source.name correctly, but errors out on event.source.Tag. Any ideas why?

Also, the event.srouce.Tag under the if event…button == event.BUTTON1 pert works.

Kyle,

In the global scripts, event.source.name works because it is an existing property on the component, and event.source.Tag shouldn’t work because it is a dynamic property. To get a dynamic property to work, you need to use .getPropertyValue or .setPropertyValue. ie: you could add the following to your global script under app.testdef test(event): value = event.source.getPropertyValue('value') print value event.source.setPropertyValue('value', 3)
and call app.test.test(event) from a button click (if that button has an integer dynamic property called ‘value’) to test it out.

Actually, it wasn’t working because it was in a popup menu function, not because it was in a global library function.

This was an oversight - it will work correctly with dynamic properties in FactoryPMI 3.1.1.

Yep, the workaround works great.

I spent 2 hours trying to figure out what i was doing wrong. I knew something was fishy