Page 1 of 1

Ui Global Events

Posted: Fri Jun 15, 2018 5:41 pm
by walterd
Hello,
is there a way to create Ui Global events when using uiConnect ? I know I can create custom event , but in my case it would be really helpful to have a Ui Global event (not the ones pre-defined).

In alternative, is it possible to create custom events with implementation right in the OOP class ?
Let me explain better:

When creating an event in a OOP with
#event myEvent(bool b)

there is no way to create an implementation of the event. You can only do it when the OOP is instantiated. At that point in the Extended tab you'll have the myEvent available to be implemented.

What I would like to have is to implement the event in the design of the OOP , thus all the object of that class will have the same event. Think about instantiating a large number of objects of the same OOP class and implement all the custom event for each one !

Thank You

Re: Ui Global Events

Posted: Sat Jun 16, 2018 7:24 pm
by mkoller
There is currently no way to add your custom UI-global event. It was requested already so maybe I'll add that in some future version.

@"implementation of the event":
You do not implement an event, you only trigger it.
Any other script can connect to it (receive the event) and implement whatever is needed.
What you see in the extended tab, is the implementation on the RECEIVER of this event.

When you want to do something on all instances of a panel reference, then simply implement a private scopeLib function inside the panelRef,
which you call internally where you would now trigger the event.

Re: Ui Global Events

Posted: Tue Jul 31, 2018 2:00 pm
by Dag-Are.Trydal@nov.com
But is there a way to set the code of the event after creating the OOP.

Example:

Code: Select all

OOP Object (OOPItem.pnl) with:
#event myEvent(bool b) 


When adding this object:
addSymbol(myModuleName(), myPanelName(), "OOPItem.pnl", refName, makeDynString(""),0,0,0,1,1);
  
setValue(refName,"position",10,10); // It is possible to set the STANDARD properties.
Is is possible to set the code of "myEvent" in a similar manner?

The following does not seem to work:

Code: Select all

setValue(refName,"myEvent","DebugN()"); 

Re: Ui Global Events

Posted: Tue Jul 31, 2018 5:08 pm
by adaneau
Hi,

An event is not a property. It can only be triggered or connected...

BR
Alex

Re: Ui Global Events

Posted: Mon Aug 26, 2019 3:45 pm
by Dag-Are.Trydal@nov.com
Okei.

I can use uiConnect to connect to events from symbols added with "addSymbol". But how can this be done when using "RootPanelOnModule"?

Code: Select all

OOP Object (OOPItem.pnl) with:
#event myEvent(bool b) 

When adding this object using "addSymbol" uiConnect is ok:
addSymbol(myModuleName(), myPanelName(), "OOPItem.pnl", refName, makeDynString(""),0,0,0,1,1);
uiConnect("testCallback", refName, "myEvent"); // testCallback works 
 
When adding this object using "RootPanelOnModule" uiConnect is NOT ok:
RootPanelOnModule("OOPItem.pnl", "oopitem", this.ModuleName, makeDynString());
uiConnect("testCallback", ???, "myEvent"); // testCallback does not work
What is the source I should insert instead of ???

BR
Dag-Are

Re: Ui Global Events

Posted: Wed Aug 28, 2019 2:28 pm
by gschijndel
Try one of the following (as described under CONTROL -> Control graphics -> Graphic objects -> Access shapes in other panels and modules):

Code: Select all

this.ModuleName + ".oopitem:"
or

Code: Select all

this.ModuleName + "." + rootPanel(this.ModuleName) + ":"