JavaLikeCalc.JavaScript
using Special.FLibSYS;

if(f_start) {
	props_value = "";
	props_geomH = geomH-props_geomY;
	objErrCode = 0;
}

title_text = objName.isEVal() ? tr("Unknown") : objName;
title_tipTool = objDescr.isEVal() ? "" : objDescr;

//Setting alarms state
if(!objErr.isEVal() && objErrCode != objErr.toInt()) {
	objErrCode = objErr.toInt();
	if(objErrCode == 2)			alarm = "50|"+objName+"||3";
	else if(objErrCode == 1)	alarm = "10|"+objName+"||3";
	else if(alarmSt&0x100)		alarm = "1|"+objName+"||1";
}
if(!objErrCode && alarmSt&0x100 && !(alarmSt&0x10000)) alarm = "";

//Changing notification-title color
alarmLev = alarmSt&0xFF;
if(alarmLev && alarmSt&0x100) {
	blinkPr = true;
	if(!objErrCode || alarmLev <= 1)	wColor = "lime";
	else if(alarmLev < 30)	wColor = "yellow";
	else if(alarmLev < 75)	wColor = "red";
	else { wColor = "grey"; blinkPr = false; }
	if(blinkPr) title_backColor = (alarmSt&0x10000 && title_backColor == wColor) ? "grey" : wColor;
	else title_backColor = wColor;
}
else title_backColor = "lime";

/*if(!objErr.isEVal()) {
	if(objErr.toInt() == 0)		title_backColor = "lime";
	else if(objErr.toInt() == 1)	title_backColor = "yellow";
	else if(objErr.toInt() == 2)	title_backColor = "red";
	else title_backColor = "gray";
}
else title_backColor = "gray";*/

if(!objItems.isEVal()) {
	//Load table with variables
	tbl = "<tbl sel='row' colsWdthFit='1'>\n"
		"<h><s width='0px'>"+tr("Property")+"</s><s width='55%'>"+tr("Description")+"</s><s width='30%'>"+tr("Value")+"</s></h>";
	for(var aIt in objItems) {
		it = objItems[aIt];
		if(it.alarm == 1)	tbl += "<r color='yellow'>";
		else if(it.alarm == 2)	tbl += "<r color='red'>";
		else tbl += "<r>";
		tbl += "<s>"+aIt+"</s><s>"+strEnc2HTML(it.descr)+"</s><s>"+strEnc2HTML(it.val)+"</s></r>\n";
	}
	tbl += "</tbl>";
	props_items = tbl;
}

for(ev_rez = "", off = 0; (sval=event.parse(0,"\n",off)).length; ) {
	//SYS.messInfo("ObjProps","Event: "+sval);
	if(sval == "ws_TableChangeSel:/props" && (it=objItems[props_value])) {
		if(!it.wr.isEVal() && it.wr != false) {
			props_geomH = set_geomY-props_geomY-2;
			set_cfg = it.wr.length ? it.wr.split(";").join("\n") : "";
			set_value = it.val;
		}
		else props_geomH = geomH-props_geomY;
		//SYS.messInfo("ObjProps","WR: "+it.wr+"; it="+it);
	}
	else if(sval == "ws_LnAccept:/set" && (it=objItems[props_value])) it.set = set_value;
	else ev_rez += sval+"\n";
}
event = ev_rez;