InternalFrameActivated and Drop Down List

stationTagPath = system.gui.getParentWindow(event).getComponentForPath('Root Container').StationTagPath

tagExists = system.tag.exists(stationTagPath)
if tagExists:
	tagList = system.tag.browse(stationTagPath)
	for tag in tagList:
		isUDT = str(tag.get('tagType'))
		if 'Udt' in isUDT:
			stationTagPath=str(tag.get('fullPath'))
print 'InternalFrame Activated {}'.format(stationTagPath)
stationTimer = stationTagPath+ '/TestResults/StationTimer'
system.nav.openWindow('HEAD', {'StationTagPath': stationTagPath,'StationCycleTimePath':stationTimer})

I have this internal frame activated script running on a window. I know many things on a window will trigger this event. I have two questions. Is there a way to filter what events trigger this script? It should run whenever the window opened.

My second question is more of an observation. In the designer I noticed internalFrameActivated scripts behave a little different than a true vision client. On my window I have a drop down list component. This component has nothing to do with this script. I noticed when this script is running the drop down list does not show its menu. If I deactivate the script, then the drop down menu behaves as it normally would. I noticed clicking the drop down menu does run the internalFrameActivated script but I don’t know why it doesn’t show its contents. why does it happen? How can I get around this?

I imagine internalFrameActivated is the wrong event handler for this task, but could you provide some more context on what are we actually trying to accomplish here? It seems unusual to open a different window every time the some other window becomes active, so I'm guessing that I'm missing the necessary context.

I need a binding on the root container. So the windowOpened event won’t work. I also need this to work every time the window is opened not only the first time. The only event handler description that fits this is internal frame activated. The window I'm opening behaves like a banner. It provides information on what’s happening at the station, like product number, serial, etc. The reason I call this in a script is so that multiple windows can use this banner/docked window.

I wonder if you could use the root container's propertyChange event handler using the property name as the qualifier:

if event.propertyName == 'StationTagPath' and system.tag.exists(event.newValue):
	for tag in system.tag.browse(event.newValue):
		#	[...]

That seems like a great way around this. I’ll give it a try when I get in the office. I did narrow down that it's specifically the openWindow() call that makes the drop down list misbehave.

1 Like

I was able to make this work. I’d still like an explanation from inductive but this is a great work around! Thank you Justin!

1 Like

A variety of things work subtly differently in the designer vs a 'real' Vision client, because the underlying abstraction behind Vision, Java Swing, is also what's running the designer itself.
So we hook various things like opening windows to do slightly different things in the designer, and my educated guess is that something about activation/focus tracking/etc is just different enough to break your script.

Testing in the Designer is good for the basics, but it's basically a truism among experienced Vision developers that you need to be testing in a real client to confirm anything.

2 Likes