Embedded module resizing / finding shape for uiConnect

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
5 posts • Page 1 of 1
mikek10
Posts:20
Joined: Wed Jun 26, 2019 4:05 pm

Embedded module resizing / finding shape for uiConnect

Post by mikek10 »

Hi,

I am having a couple of issues, solving either would suffice. I have a panel than dynamically loads several instances of a further panel using the addSymbol command, then performs a uiConnect command to handle events within its sub panels.

This panel is itself then embedded in my applications root panel and uiConnect used again to pass the events from lowest level back to top-level, this is where my troubles start. If I use an embedded module and loadpanel then the events of the lowest level panels correctly propagate back to the root panel which is good! However when loaded in this way I cannot seem to find a method to force the panel to resize itself to fit the dimensions of the embedded module - no matter what I try either part of the panel is cut-off or the embedded module itself is resized rather than its contents.

If I load the sub-panel into the root panel by using addSymbol then everything is perfectly sized to fit the dimensions I want and displays well but the uiConnect command between sub-panel and lowest level panels no longer works as it cannot find the low level object. Using a Panel Ref object instead of embedded module gives me the same issues as addSymbol.

In the root panel I have the following:

to load using embedded module:
mod_Overview.loadPanel(0,"Overview.pnl", "topOverview",makeDynString("$X:"+0, "$Y:"+0));


to load using addSymbol:
addSymbol(myModuleName(), myPanelName(), "Overview.pnl", "topOverview",
makeDynString("$X:"+618, "$Y:"+40),641,40,0,0.95,0.95,"");


uiConnect("HandleAreaPressed", mod_Overview.ModuleName+".topOverview:", "areaPressed");



in overview.pnl i have:

addSymbol(myModuleName(), myPanelName(), "clickarea.pnl", "area_"+storage.Name,
makeDynString("$Name:"+storage.Name, "$Width:"+storage.OverviewWidth,
"$Height:"+storage.OverviewHeight
, "$Segment:"+storage.Segment, "$Place:"+storage.Place
, "$FilePath:"+storage.ImagePath, "$Rotation:"+storage.Rotation)
,((float)$X+storage.OverviewX)+20,((float)$Y+storage.OverviewY+22),0,0,0,"");
//,storage.OverviewX+20,storage.OverviewY+22,0,0,0,"");

uiConnect("HandleClick", "area_"+storage.Name, "areaPressed");



I have tried using getShape first and passing the result of this as the reference in uiConnect but the shape is only found when overview.pnl is run in an embedded module in this way: anytype posref=getShape( "area_"+storage.Name);

I am assuming that the issue with running via addSymbol is due to the parent panel being different but I have tried many variations of specifying module and panel name but cannot seem to hit on a combination where the shape is found :(

Thanks in advance for any help.


EDIT:

I eventually figured it out:
uiConnect("HandleClick", myModuleName()+"."+myPanelName()+":area_"+storage.Name, "areaPressed");

mikek10
Posts:20
Joined: Wed Jun 26, 2019 4:05 pm

Re: Embedded module resizing / finding shape for uiConnect

Post by mikek10 »

Hi, so this works in 3.17:
uiConnect("HandleClick", myModuleName()+"."+myPanelName()+":area_"+storage.Name, "areaPressed");

however in 3.15 the same gives an error:
WCCOAui (1), 2020.12.10 15:40:33.702, CTRL, WARNING, 17, Requested panel does not exist,

I guess there is subtly different way to reference the panel?

mikek10
Posts:20
Joined: Wed Jun 26, 2019 4:05 pm

Re: Embedded module resizing / finding shape for uiConnect

Post by mikek10 »

So, following further investigation from my last post, if want to load a panel and connect to its "StateChanged" event I have the following:


mod_Layout.loadPanel(0,"layout.pnl", "Layout:",makeDynString("$param1:"+param1, "$param2:"+param2,"$param3:"+param3,
"$Columns:"+storage.Columns,"$MaxHorizontal:"+(mod_Layout.visibleWidth-2),"$MaxVertical:"+(mod_Layout.visibleHeight-2 )));

uiConnect("HandleStateChanged", mod_Layout.ModuleName+".Layout:", "StateChanged");



This works perfectly in 3.17. In 3.15 I get the following:

WCCOAui (1), 2020.12.14 06:59:04.818, CTRL, WARNING, 17, Requested panel does not exist,
Module: _QuickTest_
Panel: C:\myproject\panels\newview.pnl [newview.pnl]
Script: Initialize
In panel scope library: newview.pnl []
Line: 128, uiConnect, Layout


The code works in 3.17 and seems to agree with the help files for both 3.15 and 3.17 so I don't know how to fix this behaviour?

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Embedded module resizing / finding shape for uiConnect

Post by leoknipp »

Without having the panels you are using it is difficult to find the cause for the problem.
Maybe you can get in contact with your common WinCC OA support to share the panels and the description how to use the panels.

Possibly there have been some changes/bugfixes between 3.15 and 3.17 which are causing the different behaviour.

Best Regards
Leopold Knipp
Senior Support Specialist

mikek10
Posts:20
Joined: Wed Jun 26, 2019 4:05 pm

Re: Embedded module resizing / finding shape for uiConnect

Post by mikek10 »

Thanks, I appreciate the difficulty without having the panels available. I could not find a solution to referencing a panel with UIConnect when it was loaded via an embedded module in 3.15. As you say there have probably been fixes which is why it works in 3.17. However, I found a solution that is adequate for my needs this morning by using addSymbol to dynamically load the panel rather than an embedded module. With addSymbol the code is:

addSymbol(myModuleName(), myPanelName(), "layout.pnl", "Layout",
makeDynString("$param1:"+param1, "$param2:"+param2,"$param3:"+param3,
"$Columns:"+storage.Columns,"$MaxHorizontal:"+(400),"$MaxVertical:"+(400 )),0,0,0,0.95,0.95,"");


uiConnect("HandleStateChanged", "Layout", "StateChanged");

5 posts • Page 1 of 1