Object Oriented ctrl scripting
Since I the O.O.P. features became available in WinCCOA's control scripting I find myself using then increasingly more often due to the
better structured code they allow.
With every new release I keep hoping for one or two features to pop up, but seeing as they haven't I though I might try dropping some
hints through this forum. [Dear Santa]
The following 2 features would be really nice to have:
-Access to built-in member functions of dyn/vector/string types when nested:
If I build a class that contains a vector<sometype>, and I make this vector public, there is no easy way to iterate the vector without copying it to an outside variable first, or adding some wrapper function around it's "count()" member function. This is because vectors do not have a dynlen equivalent function, and when you try to call instance.vector.count() to get the length, winccoa will throw an error : "Expression is not an array".
I dont quite understand why nested member functions I write myself are not a problem, but winccoa's very own member functions dont work for nested variables. This would allow for much cleaner code IMO.
-Some type of eventing for user built classes:
If I want to build user interfaces based on OOP ctrl classes, I have to resort to ugly workarounds to get any event-driven interactions going between my instances and my panels. It would be awesome if classes had an event that could be triggered by the class that can simply be connected to with uiConnect().
Another example would be scripts with lots of objects, the objects themselves can do a dpConnect() within their own context, but I still have to resort to polling the objects to check if something has changed within them.. Example: an item class connects to a datapoint with a regular dpConnect which updates the object. If I have a container class that wraps around the item classes I would like to notify this class whenever something changes.. what do I use (apart from polling)? Some callback mechanism that does not require datapoints (or panels) could be very useful.
TLDR: OOP control scripting is awesome, here are 2 suggestions to make it even more so.
The WinCC OA Portal can be used to share information and to discuss topics with other WinCC OA users.
Senior Support Specialist