Is it possible to create designer scope variables? If so, how?
Specifically I am designing a project and would like to use OO structure: ie design a class object then create instances at run time. These instance variables will be client scoped.
But my current challenge is how do I create instances of this class in the designer for testing. To test the app it seems I need to run up a client for each test.
Am I missing something? Is there an alternative?
Ignition can accommodate most OO design techniques… You can certainly create reusable classes in python and instantiate multiple instances at runtime in a client. You can create UDT for tags, and you can create templates for windows. Please provide a bit more information on what you’re trying to do?
# define a class
# Instantiate a class
myclass = MyClass()
# run the method
How are you creating the instances in the client? For the most part the designer is just another client so you can do the same.
The designer won’t run visionWindowOpened or internalFrame scripts, or client event scripts, but it will run button clicks and other events for controls on screen when in “run” mode. There is also the script console where you can run whatever code you like, which is useful for testing.
Looking back, my question was not quite clear.
My issue was with TESTING, not designing or programming.
So yes DavidWisely, it is simple to design OO code. Testing in Ig designer was what I needed to understand better
systemparadox put me on the right thought process.
I’m not sure yet how I will instantiate the class object… but most likely in a client start script.
So, to answer my own question, and I have learnt something along the way:
In the designer I need to instantiate the object. I can use a temporary button, or most likely a single line in the script console.
What I found interesting is that I only need to instantiate the object ONCE in the lifetime of the designer. The designer can be switched from design to run any number of times and the objects persists.
All good. Thanks again systemparadox
This for me was the missing piece. Hopefully it may help others
…and yes, in this context the designer is just another client …