为实现弹出窗口,我们为开始屏幕添加一个屏幕窗口。此时,暂不需要设置属性:
I gave it a visibility animation based on an internal tag (“bShowPopup”). I also gave it direct movement animations based on internal tags (“X_Position” and “Y_Position”).
我给它一个基于内部标签可见性动画(“bshowpopup”)。我也把它直接运动动画基于内部标签(“x_position”和“y_position”)。
I put the actuators in screen windows to take advantage of the tag prefix. The tag prefix is used for the popup and allows for quicker assignment of all of the animations and events associated with the actuator in the screen window.
先制作好执行器的画面,然后把它放置在HMI屏幕窗口中。我把执行器放在屏幕窗口,利用标签前缀。标签前缀用于弹出,可以更快地分配所有的动画和在屏幕窗口执行相关事件。
编写如下的一段C语言脚本,将窗口的属性传递给弹出窗口。
#include "GlobalDefinitions.h"
void
OnClick(
char
* screenName,
char
* objectName,
char
* propertyName)
{
ActivateScreenInScreenWindow (
"MAIN"
,
"Popup_Screen"
,
"Motor_Popup"
);
SetPropertyByConstant(
"MAIN"
,
"Popup_Screen"
,
"TagPrefix"
,
GetPropChar(GetParentScreen(screenName), GetParentScreenWindow(screenName),
"TagPrefix"
));
SetTagByProperty (
"@NOTP::X_Position"
, GetParentScreen(screenName),
GetParentScreenWindow(screenName),
"Left"
, hmiWithoutOperatorEvent);
SetTagByProperty (
"@NOTP::Y_Position"
, GetParentScreen(screenName),
GetParentScreenWindow(screenName),
"Top"
, hmiWithoutOperatorEvent);
SetBit (
"@NOTP::bShowPopup"
);
}
第一个语句取决于正在使用的画面。本句的意思是,弹出窗口已经更新为电机弹出窗口。
The second statement of the script sets the tag prefix of the popup window to use the same tag prefix as the screen window. The function “SetTagByProperty” is setting “X_Position” without an operator event, with the property “Top” (the top edge of the screen window), from the parent screen window in the parent screen.
这个脚本的第二句套弹出式窗口的标记前缀使用相同的标记前缀为纱窗。功能settagbyproperty”设置“x_position”没有运营商的事件,与物业的“顶”(屏幕窗口的顶部边缘),在父母的屏幕窗口的屏幕。
最后一句设置位变量“bshowpopup”,将弹出式窗口可见性设置为真。
如果你使用的是WinCC专业版,使用客户机/服务器配置的话,请注意:
确保“bshowpopup”、“x_postion”、和“y_position”这些属性仅在本地触摸屏更新。如果您使用的是客户机/服务器选项,则动画将在所有的触摸屏上起作用,而不仅仅是你在用的那台触摸屏。