Put a dictionary onto a root container as a custom property?

I have a popup window that can be called from multiple other windows.

Depending on which main window calls the popup I want to determine the UI update when the user is done creating/updating the record.

I already have a generic way to update the UI for the current user using a list of dictionaries (which have sub dictionaries which makes this a little ill-suited for a dataset).

Therefore I think the easiest way for me to do this would be to put the UI Update data as a custom property on the root container of the window which will then get fed to my generic message handler that updates the UI.

I am in script console and I thought .putClientProperty was the way to go but this

win = system.gui.getWindow("Pop_AddEditUser")
rc = win.getRootContainer()
rc.putClientProperty("updateAfter",{"something":1})

for prop in rc.properties:
	if prop == 'updateAfter':
		print prop
		
for thing in dir(rc):
	if thing == 'updateAfter':
		print thing

rc.updateAfter

shows me nothing, I can’t seem to access, and the last line gives me an attribute error.

Is there a way to do this?

I’m not positive, but a client property isn’t the same thing as a custom property, so wouldn’t the last line be this?

rc.getClientProperty('updateAfter')
3 Likes

Ahh, I should have realized to use a getter after using a setter. That works, thank you!

You are correct. .getClientProperty() is the only way to retrieve them.

3 Likes