Page 87 - 4222
P. 87
В редакторі скриптів створюємо програму, яка б
змінювала напис тексту на даній кнопці, розміри самої кнопки
та розміри головних елементів схеми.
Найпростіша програма може мати приблизний вигляд:
#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName,
char* lpszPropertyName, UINT nFlags, int x, int y)
{
int w;
if ( w ==100 ) {SetWidth("Events.PDL","Button2",200); //Return-
Type :long int
SetText("Events.PDL","Button2", "ще раз збільшити");
SetWidth("Events.PDL","Tank3",150); //Return-Type :BOOL
SetHeight("Events.PDL","Tank3",210); //Return-Type :BOOL
SetWidth("Events.PDL","Meter1_0100",150); //Return-Type :BOOL
SetHeight("Events.PDL","Meter1_0100",150); //Return-Type :BOOL
SetLeft("Events.PDL","Tank3",70); //Return-Type :BOOL
}
if ( w ==200 ) {SetWidth("Events.PDL","Button2",300); //Return-
Type :long int
SetText("Events.PDL","Button2", "зменшити");
SetWidth("Events.PDL","Tank3",170); //Return-Type :BOOL
SetHeight("Events.PDL","Tank3",230); //Return-Type :BOOL
SetWidth("Events.PDL","Meter1_0100",170); //Return-Type :BOOL
SetHeight("Events.PDL","Meter1_0100",170); //Return-Type :BOOL
SetLeft("Events.PDL","Tank3",50); //Return-Type :BOOL
}
if ( w ==300 ) {SetWidth("Events.PDL","Button2",100);
SetText("Events.PDL","Button2", "збільшити");
SetWidth("Events.PDL","Tank3",130); //Return-Type :BOOL
SetHeight("Events.PDL","Tank3",190); //Return-Type :BOOL
SetWidth("Events.PDL","Meter1_0100",120); //Return-Type :BOOL
SetHeight("Events.PDL","Meter1_0100",120); //Return-Type :BOOL
SetLeft("Events.PDL","Tank3",90); //Return-Type :BOOL
}
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
}
87