Page 1 of 1

Embedded Module panel accessibility

Posted: Tue Nov 20, 2018 3:39 pm
by SebastianR
Hello everyone, I'll just be straightforward:
I have a panel/window which contains a tree view and an Embedded Module and a button - based on the selection in the tree view I load panels into the Embedded Module - and pressing said button I want to call a public function within the Scope Lib of the panel which is loaded into the Embedded Module.
Is it possible to do this or is the Embedded Module not made for this use case?

So far I tried getShape()/getShapes() on the Embedded Module but I could only ever get shapes which are inside the panel which is loaded into the Embedded Module, not the panel itself.
I was unlucky regardless, because even though I declared public functions within a shape in its Initialize scope, I still wasn't able to call it.
Additionally I switch the panels in and out using RootPanelOnModule() which doesn't need a shape name, which makes using getShape(s) a bit more difficult.

The most obvious thing to do is to just try and call the shape directly on button press, which won't work as well, as was expected.

The help doesn't really provide any in-depth information about Embedded Modules and searching the forum yielded no relevant posts to me, so here I am.

Has anyone done this before?
Do I just have to use addSymbol() instead and throw away the Embedded Module?

Any help is appreciated!
Kind regards,
Sebastian

Image

Re: Embedded Module panel accessibility

Posted: Wed Nov 21, 2018 8:11 am
by mkoller
it is possible. You can call any public function from any panel, regardless if it's loaded in a Module either embedded or not, even opened in a child panel.
Do it like this:
invokeMethod("embeddedModuleName.PanelNameInside:", "publicFunctionName", argument1, argument2);

The key here is: how to address the panel itself, which is the usual syntax ".:" (don't forget the colon at the end)

Re: Embedded Module panel accessibility

Posted: Wed Nov 21, 2018 11:51 am
by SebastianR
Hey Martin!

Thanks for your answer, this works perfectly!

Also thanks to Gertjan for fixing the picture in the original post, I somehow got that wrong..

Re: Embedded Module panel accessibility

Posted: Mon Dec 10, 2018 11:11 am
by philipp.wechsler
The invokeMethod it's nice to use.
I have only a timing problem. The invokeMethod works only if I have a delay of more than 10ms between the RootPanelOnModule and the invokeMethod.

Code: Select all

RootPanelOnModule( ... );
delay( 0, 10 );
invokeMethod( ... );
Is there another solution that work without a delay? Or an action when the panel has finished loading on the module?

Re: Embedded Module panel accessibility

Posted: Mon Dec 10, 2018 11:20 am
by SebastianR
Hey Philipp!

I recommend using the Initialize event within the panels which you are loading in RootPanelOnModule().
If you need some parameters you can always pass them as parameters within the RootPanelOnModule() call as well.

Edit:
To give an example:

RootPanelOnModule("mypanel", "myId", "myModule", makeDynString("$param:" + myparam));

Re: Embedded Module panel accessibility

Posted: Mon Dec 10, 2018 11:34 am
by philipp.wechsler
I can't transfer a ctrl++ object by the $-parameter for initialize. That's the reason that I need the public method after loading.

https://portal.etm.at/index.php?option= ... 6&id=10257