Hi, I have created a script in the project library for dynamic popup to which I send parameters such that my popup view is rendered according to the parameters on clicking a button. But the problem is, there seems to be glitch every time the popup is supposed to appear, it seems the glitch lasts only for a second but it is the skeleton view of the popup without the editing parameters. Does anyone know how this can be solved?
Please edit your question and add the perspective
or vision
tag from the dropdown.
Make a recording of the glitch and add it to your post.
Okay
Show your Save button code. Please see Wiki - how to post code on this forum.
from Popup.DynamicPopup import DynamicPopup
popup = DynamicPopup(popup_id = 'GenricPopup123')
Application = self.getSibling("ddApplications").props.value
parameters = {
"messageHead": 'Validation Error!',
"message": 'Application is required.',
"canShowDeleteBtn": 0,
"canShowConfirmBtn": 1,
"canShowCancelBtn": 0,
"confirmBtnTxt": "OK",
"deleteBtnTxt": "OK",
"cancelBtnTxt": "Cancel",
"EventName": "ValidationApplication",
"messageHeadColor": '#ff5d5d'
}
if Application == "value" or Application == "All":
popup.openPopup(parameters)
Q1. Why are you using a library instead of Ignition's native system.perspective.openPopup | Ignition User Manual?
Q2. How did you expect anyone to answer your first post without the information that you were using an external library?
- I’m using library so that I can use the same view to display different messages in my application according to my need.
- I did mention in my first post in the first line that I’m using an external library - Hi, I have created a script in the project library for dynamic popup
- Laudable, but Ignition has other tools to do this natively.
- I don't understand why you would think we could help you with a dynamic popup script that you aren't showing us. (The error appears to be from React on the browser.)
I’ll look into the react issue and if possible into other tools. Thank you
I assume you mean this:
You should familiarize yourself with the persistent
property of bindings. I’m guessing the button text is bound to a parameter, but the default text of “Button” will show for a split second before the binding is resolved from an initial null value. You can provide an alternate default value for an initial null value by using the coalesce
function in a binding expression:
coalesce({view.params.buttonText}, '')
That should make the button appear blank before the parameter text shows up, assuming the text property is not set to persistent
(the default for bound values).
Alternatively, you could check the persistent
property of the text, in which case whatever value is present when you save the view is what will initially appear.
The OP seems to be using an external popup library. It's unlikely that it can handle Ignition expressions.
He says he created it, though, so I’m assuming it’s just a project library script…
Until the OP shares all relevant scripts, we simply cannot know what is going on.
My money’s on a wrapper around the built in popup function.
I also do that sometimes, for generic popups like info messages or confirmations.
I also thought about going deeper into it but it hardly seems worth it.
Same here. Though since they are for convenience, they don’t require an imported class instance. Their use looks as simple as:
UI.successPopup('You done good!')
They can take more parameters, but they’re mostly optional, with default values (something I love about Python).
It can be a very simple class, but then you’ll ask “why use a class then?”
OOP has been ingrained in the mind of a lot of devs. I’ve heard some say things like “If it’s not in a class, it’s not production grade”.