Using uiConnect for Clicked event of Rectangle?

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
flindecke
Posts:69
Joined: Wed Jun 24, 2015 1:54 pm

Using uiConnect for Clicked event of Rectangle?

Post by flindecke »

Assume we have a rectangle uxBackground with a Clicked event handler

Code: Select all

?// [uxBackground] [2] - [Clicked]
main(mapping event) { 
  // do something special on click
}
Now for less writing of code, i want to use uiConnect (executed in a library on panel initialization).

Code: Select all

?// [(Panel)] [0] - [Initialize]
// will be later in library
void _handleClicked(const mapping& event) {
  DebugTN(__FUNCTION__,event);
}

main() { omf_base_ui_component_init(model);
  uiConnect("_handleClick", uxBackground.name, "Clicked");
}

But when i execute this code, i get an error in uiConnect line, depicting, that a function is not defined.
How to connect on such events? (i want to connect on Clicked, MouseRelease and MousePressed later)

With regards,
Frank Lindecke

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: Using uiConnect for Clicked event of Rectangle?

Post by Gertjan van Schijndel »

You could try it again, but with the '_handleClicked' function in the scopelib of the panel.

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: Using uiConnect for Clicked event of Rectangle?

Post by mkoller »

You can't. uiConnect() can only connect to user defined events but not to the system defined standard events which only start their respective scripts.
You can only call your function from the lib from inside the objects "clicked" script.

flindecke
Posts:69
Joined: Wed Jun 24, 2015 1:54 pm

Re: Using uiConnect for Clicked event of Rectangle?

Post by flindecke »

Thanks for clarification.

It would be nice to see this "feature" in the future.

I am currently developing a library to simplify creating symbols with a "convention" behavior, i.e. when a symbol with "uxBackground" is available and developer defines a "capability" the library should automatically do the rest.
It would be nice to get rid of the symbols "clicked" script (and also the mouse pressed and release scripts). Less code, less errors while developing those symbols.

4 posts • Page 1 of 1