JavaLikeCalc.JavaScript
if(f_start)	isErr = false, alBlnk = false, cnt = 0, fixText = (text != "---");

//Prepare/update the context menu
if(f_start || ((cnt++)%max(1,f_frq*10)) == 0) {
	contextMenu = "";
	if(!digComs.isEVal() && digComs.length) {
		if(!com_text.isEVal())
			for(off = 0; (comVal=digComs.parse(0,";",off)).length; )
				contextMenu += comVal.parse(0,"-") + ":" + comVal.parse(0,"-") + "\n";
		else {
			if((comVal=digComs.parse(0,";")).length)	contextMenu += comVal.parse(0,"-") + ":open\n";
			if((comVal=digComs.parse(1,";")).length)	contextMenu += comVal.parse(0,"-") + ":close\n";
			if((comVal=digComs.parse(2,";")).length)	contextMenu += comVal.parse(0,"-") + ":stop\n";
		}
	}
}

//Display label from st_text
stCur = -1;
if(!st_text.isEVal() && st_text.length) {
	if(!fixText)	text = st_text.parse(0,":");
	blink = st_text.parse(2,":").toInt();
	backClr = st_text.parse(1,":").parse(0,"-");
	if(blink) {
		backClrBl = st_text.parse(1,":").parse(1,"-");
		if(!backClrBl.length)	backClrBl = "gray";
		backColor = (backColor!=backClr) ? backClr : backClrBl;
	}
	else	backColor = backClr;
}
//Display typical for st_open
else if(st_open == true || st_close == false) {
	backColor = (stVal=digStts.parse(0,";").parse(1,"-")).length ? stVal : "green";
	if(!fixText)
		text = (!digStts.isEVal() && (stVal=digStts.parse(0,";").parse(0,"-")).length) ? stVal : tr("Enable");
	stCur = 1;
}
else if(st_open == false || st_close == true) {
	backColor = (stVal=digStts.parse(1,";").parse(1,"-")).length ? stVal : "blue";
	if(!fixText)
		text = (!digStts.isEVal() && (stVal=digStts.parse(1,";").parse(0,"-")).length) ? stVal : tr("Disable");
	stCur = 0;
}
else {
	backColor = "grey";
	if(!fixText) text = "---";
	return;
}
if(!backColor.length)	backColor = "black-1";	//For the activity cursor

//Blink linked with ElCadr
if(this.attr("focus") ||
	(!NAME.isEVal() && this.wdgAt("/s/pg_control/pg_ElCadr",true).attr("pgOpen") && this.wdgAt("/s/pg_control/pg_ElCadr",true).attr("prmShifr") == NAME))
{
  bordColor = (bordColor != "white") ? "white" : "black";
  bordWidth = 2;
}
else if(bordWidth) { bordWidth = 1; bordColor = "black"; }

//Notification create
if(ntf.length && (ntf.toInt() == stCur) != isErr) {
	if((isErr=(ntf.toInt()==stCur)))	alarm = "50|"+NAME+"|"+ntf.parse(2,":")+".|"+ntf.parse(1,":");
	else if(alarmSt&0x100)	alarm = "1|"+NAME+"||1";
}
if(!isErr && alarmSt&0x100 && !(alarmSt&0x10000)) alarm = "";
if(alarmSt&0x100) {
	if(!(alarmSt&0x10000) || alBlnk)	backColor = isErr ? "red" : backColor;
	else backColor = (backColor=="gray")?"#383838":"gray";
	alBlnk = !alBlnk;
}

//Events process
for(ev_rez = "", off = 0; (sval=event.parse(0,"\n",off)).length; ) {
	//SYS.messInfo("TextLab","Event: "+sval);
	if(!com_text.isEVal() && sval.indexOf("usr_") == 0) {
		com_text = comVal = sval.slice(4);
		SYS.messNote("OP:"+this.ownerSess().user()+":"+NAME,"'"+NAME+"'. "+tr("Command")+" : "+DESCR+" : : "+comVal);
	}
	else if(sval == "usr_open") {
		if(!com.isEVal())	com = true;
		else close = false;
		comVal = (comVal=digComs.parse(0,";")).length ? comVal.parse(0,"-") : tr("ENABLE");
		SYS.messNote("OP:"+this.ownerSess().user()+":"+NAME,"'"+NAME+"'. "+tr("Command")+" : "+DESCR+" : : "+comVal);
	}
	else if(sval == "usr_close") {
		if(!close.isEVal())	close = true;
		else com = false;
		comVal = (comVal=digComs.parse(1,";")).length ? comVal.parse(0,"-") : tr("DISABLE");
		SYS.messNote("OP:"+this.ownerSess().user()+":"+NAME,"'"+NAME+"'. "+tr("Command")+" : "+DESCR+" : : "+comVal);
	}
	else if(sval == "usr_stop") {
		if(!stop.isEVal())	stop = true;
		comVal = (comVal=digComs.parse(2,";")).length ? comVal.parse(0,"-") : tr("STOP");
		SYS.messNote("OP:"+this.ownerSess().user()+":"+NAME,"'"+NAME+"'. "+tr("Command")+" : "+DESCR+" : : "+comVal);
	}
	else ev_rez += sval+"\n";
}
event = ev_rez;