im building QV object extension but it have very strange behaviour. Im in the beggining of the development process and so far the extension itself is very simple
get the current document
get 'LB03' object
wait until the object is finished
get the object values
display this values in the extension and color them based on their state
The problem is that for some reason when i select values anywhere on the document `SetOnUpdateComplete` function is being called multiple times (usually 3 times) and this makes my object to be re-drawn multiple times as well which leads to some "flickering" - at one moment i can see the old values (with the selection state before the selection), then i can see all values (old and new) and finally i can see the new values
When a GetObject is called, it creates an Object Manager, which is attached to the list of Managers in the Document Manager list. This List gets notified whenever anything changes in the document (eg selections). So basically any selection will generate a refresh and a subsequent callback of every object you have gotten via GetObject.
I have seen suggestions on setting the callback to only run once by using a variable, but that still keeps an ever growing list of Object Managers tied to document selections and will make the document slower and more unstable over time.
What you could do is to remove the object manager from the list of document managers at the end of the callback. It doesn't get it out of the memory, but it will not be listening to any events in the document anymore. (for example this.DocumentMgr.RemoveFromManagers(this.ObjectMgr) at the end of your callback.