openTrendCurves as childpanel

Find and share HowTos to various installations / configurations!
6 posts • Page 1 of 1
Kirvesmies
Posts:42
Joined: Mon Dec 04, 2017 2:28 pm

openTrendCurves as childpanel

Post by Kirvesmies »

At least 3.16 version of openTrendCurves uses ModuleOnWithPanel function to open a trend. It then opens it to the top left corner of the screen. Is there an easy way to change this so it opens as a childpanel (with movable, sizable, and closable window frame)?

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

Re: openTrendCurves as childpanel

Post by leoknipp »

The function openTrendCurves() is defined in scripts/libs/ac.ctl.
If you want to open a childpanel instead of a module you can copy the library to your project and change the function.

Best Regards
Leopold Knipp
Senior Support Specialist

Kirvesmies
Posts:42
Joined: Mon Dec 04, 2017 2:28 pm

Re: openTrendCurves as childpanel

Post by Kirvesmies »

I was hoping there was an easier way to do this without copying the ac.ctl to the project. I am worried that future WinCC versions have updated that library and then I or whoever is responsible for updating will have to remember updating this in parallel.

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

Re: openTrendCurves as childpanel

Post by leoknipp »

You can
-- create or use an own CTRL library
-- copy the code for openTrendCurves() to your library
-- rename the function to any other function name, e.g. CS_openTrendCurves() (CS is for customer specific)
-- call CS_openTrendCurves() instead of openTrendCurves() in your panels

Best Regards
Leopold Knipp
Senior Support Specialist

Kirvesmies
Posts:42
Joined: Mon Dec 04, 2017 2:28 pm

Re: openTrendCurves as childpanel

Post by Kirvesmies »

Hi :blush:
Replacing ModuleOnWithPanel with ChildPanelOnRelativ in openTrendCurves does not seem to be enough to change it to open as a childpanel. *Ripping the little hair I have left with this*

Code: Select all

      
...
//ModuleOnWithPanel("Trend_"+myModuleName(),
//    -1, -1, 0, 0, 2, 2, "Scale",
//    "vision/trend/VT_trend.pnl",
//    trendName,
//    makeDynString("$VARTRENDDP:"+DP));
    
ChildPanelOnRelativ("vision/trend/VT_trend.pnl",
      trendName,
      makeDynString("$VARTRENDDP:"+DP),
      0, 0);
...

Kirvesmies
Posts:42
Joined: Mon Dec 04, 2017 2:28 pm

Re: openTrendCurves as childpanel

Post by Kirvesmies »

In case someone else needs it..share the fun
Solved it somewhat like this:
1. create a new panel: CS_VT_trend.pnl
2. insert VT_trend.pnl to CS_VT_trend.pnl, $DP = (empty) , $SHOWLEGEND = 1
3. add initialize script in CS_VT_trend.pnl:
main()
{
dpSet("_VarTrendOpen.UiNumber:_original.._value",myUiNumber(),
"_VarTrendOpen.PanelName:_original.._value",myModuleName(),
"_VarTrendOpen.TrendData:_original.._value",$transferstring);
}
4. make a customer specific modified CS_openTrendCurves:
...
// ModuleOnWithPanel("Trend_"+myModuleName(),
// 0, 0, 0, 0, 1, 1, "",
// "vision/trend/VT_trend.pnl",
// trendName,
// makeDynString("$VARTRENDDP:"+DP));

ChildPanelOnCentral("CS_VT_trend.pnl",
"Trend_"+trendCurves,
makeDynString("$transferstring:"+transferstring));
...

6 posts • Page 1 of 1