Visibility of a reference panel in one faceplate

Find and share HowTos to various installations / configurations!
5 posts • Page 1 of 1
amenoyo
Posts:7
Joined: Mon Mar 02, 2015 11:35 am

Visibility of a reference panel in one faceplate

Post by amenoyo »

The doubt is how to make invisible a reference panel inside one faceplate.

I have make this script:

Code: Select all

main() 
{ 
  dpConnect("visibilidad","EBAB_IZ01_SB_B_001.E.local:_address.._active","EBAB_IZ01_SB_B_001.E.remote:_address.._active"); 
}  
visibilidad(string variable, int valor, string variable1, int valor1) 
{ 
if (valor == 1) 
PANEL_REF3.visible(false);
else if (valor1 == 0) 
PANEL_REF2.visible(TRUE); 
else
PANEL_REF1.visible(TRUE);
This is not working, but if I make this with rectangles in the same faceplate they appears and disappears without problems. I think that the script is not able to access one reference panel and only access to real objects introduced in the faceplate. The reference panel I´m using is inside symbols_bool --> stdlib_boolbutton1.

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

Re: Visibility of a reference panel in one faceplate

Post by leoknipp »

if you want to set the attributes for a reference you have to use the CTRL-command setValue() instead of the dot-notation.
E.g. setValue("PANEL_REF0","visible",false);

When using the dot-notation for a reference you should see the following error in the PVSS_II.log-file.
WCCOAui (1), 2015.05.06 18:04:29.895, CTRL, WARNING, 13/uim,
Module: _QuickTest_
Panel: D:\\WinCC_OA\\projects\\test_313\\panels\\ref_visibility.pnl []
Object: 4 named: "PUSH_BUTTON1" of type: PUSH_BUTTON
Script: Clicked
Line: 3, Objekt "PANEL_REF0" existiert nicht in "-dot notation-()"

Best Regards
Leopold Knipp
Senior Support Specialist

amenoyo
Posts:7
Joined: Mon Mar 02, 2015 11:35 am

Re: Visibility of a reference panel in one faceplate

Post by amenoyo »

I have the same problem, I can`t put the reference panel invisible. I have make this script in the initialize of the faceplate, becuase I want to show reference A or reference B depending which periphery address is active.

I send you the script with the setValue:

Code: Select all

main() 
{ 
  dpConnect("visibilidad","EBAB_IZ01_SB_B_001.E.local:_address.._active","EBAB_IZ01_SB_B_001.E.remote:_address.._active"); 
}  
visibilidad(string variable, int valor, string variable1, int valor1) 
{
  if (valor == 1) 
   setValue("PANEL_REF2","visible",false);
  else if (valor1 == 1)
    setValue("PANEL_REF7","visible", "true");
 else 
   setValue("PANEL_REF7","visible", "false");
}

amenoyo
Posts:7
Joined: Mon Mar 02, 2015 11:35 am

Re: Visibility of a reference panel in one faceplate

Post by amenoyo »

I have find which was the problem, the script works find with setvalue, but the panel reference I want to hide was scripted with other Initialized script which was executed after my script in the initialize of the faceplete and makes the button visible another time.

SOLUTION: I put one delay on my script that makes my script being executed later than the panel references script.

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: Visibility of a reference panel in one faceplate

Post by fmulder »

Adding delays is very bad !!!!!!!! Please consider a better solution:

a) Consider to use addSymbol() to add the reference. Maybe pass it a dollar code to tell it what to do
b) Never show/hide shapes in two places. Solution : the script code could use show/hide. The faceplate coukld cover the right shape

Adding a delay is quite often an excuse for something that was coded bad.

5 posts • Page 1 of 1