Passing parameter into popup

I have created a popup with simple text on it. It comes up at two points and displays the text on that view. I would like to use this same popup but replace the text with different text that I would like to pass in from a system.perspective.openPopup command.

Existing popup. Created custom property “myLabel” which contains base text and text object on this popup is bound to myLabel.

Call to popup based on change script on text.

image

The correct popup does come up but the text is not displaying the new text, still the old original text.

What am I doing wrong?

Anything that needs to come into a view from outside of the view needs to be passed through the params section not the custom section a view.

As for your code, can you post it as text using the preformatted button from the thread editor: image ? That way we can double check that side of things. But I’m going to guess that you move your myLabel from custom to params and it’ll work.

As you suggested I did change myLabel on both Popup and call to popup to params and made sure popup direction was going in and parameter myLabel on other view calling the popup had direction going out. And it worked! Minor brain fart forgetting about params versus custom params
Thanks!

	myText = self.props.text
	noChar = len(myText)
	
	if noChar == 10:
		myTag = '[{}]Cell/Control/Process Data/Batch Meta/Job'.format(self.view.params.CellId)
		system.tag.write(myTag,myText)
	else:
		param1 = self.view.params.myLabel
		system.perspective.openPopup('PartsIssuePopup', 'Popups/Alert', params = {'myLabel' : param1},
			showCloseIcon = False, 	draggable = False, resizable = False, modal = True)
2 Likes

Awesome! Glad it worked.