Script recursion issue when main window resized

Greetings…

I’m having an issue with a Tab/Sub-Tab setup. The navigation script for the tabs seems to works great, but there is a serious problem if the window is resized. The popup, of course, does not resize with the window, but the problem occurs while dragging the window border when the popup boundary crosses the main window boundary. It causes the tabs navigation script to go into some weird recursion loop where it it opening and closing the same popup a few hundred times. If you drag the window back to original size, the recursion stops (eventually). No errors are generated unless you let the recursion go on for a while and then a recursion limit reached error is thrown. In some cases where I let the recursion go on too long I have to go to the task manager to kill the client.

Does this make sense? If not, I have attached a test .proj to illustrate. I have turned on the window and popup borders for testing.

popup recursive bug.proj (58.1 KB)

I would appreciate any insight as to what may be causing this, and more importantly, how to resolve it. :sunglasses:

Cheers,
Steve

The problem is your scripts on the Action <n> Tab tab strips. You have your script in the ‘propertyChange’ event handler - but you’re not filtering the property name. Thus, every time any property on the tab strip changes, it fires your script - which, in the process of opening/manipulating the windows, fires the script. The primary culprit is the ‘vision.Bounds2D’ property being fired, most likely due to the setLocation call you’re performing on the window. If you just add a property filter before the rest of your code it stops this behavior:

#Universal Sub-Tab Script - S.Brannen sbrannen@bastiansolutions.com
#win: get path of current max window and convert to PyObject
if event.propertyName == 'selectedTab':
	win = system.gui.getWindow(system.nav.getCurrentWindow()) 
	par = system.gui.getParentWindow(event) #assign tab event parent
	tab = event.source.selectedTab #assign selected sub tab
	all = system.gui.getOpenedWindows()#tuple open windows
	
	#if the current win is the tab event window & tab is visible
	if win == par and event.source.visible:
		for pop in all:
			if pop.layer == 1:
				system.nav.closeWindow(pop) #close previous sub-tab popup
			win = system.nav.openWindow(tab) #open popup of selected tab
			win.setLocation(par.width/2 - win.width/2,218) #center x, set y
	elif win != par: #if the current window is not the event window
		for pop in all:
			if pop.layer == 1:
				system.nav.closeWindow(pop) #close all popups

Thanks Paul! I’m new to Ignition and Python… a lethal combination. :slight_smile:

[EDIT] Although filtering stopped the script from firing, it also stopped the scrip from working correctly. I will keep plugging along. At least I am on a path now whereas before I fell off a cliff.