Добрый день.
Подскажите, как дополнить скрипт, чтобы кроме цвета выдавалось сообщение?
(т.е. как туда пристроить процедуры Mess.Show (1), Mess.Show (2) и т.п. )
with Sender as TM_Object do
if VariableEx.AsBool then
Color := clRed // + сообщение
else if AsBool then
Color := clYellow // + сообщение
else
Color := clGreen;
Спасибо.
Здравствуйте.
Если нужно выполнить несколько действий, то просто заключите их в begin...end. Например:
with Sender as TM_Object do
if VariableEx.AsBool then
begin
Color := clRed;
// другие действия...
end else
if AsBool then
begin
Color := clYellow;
// другие действия...
end else
Color := clGreen;
Вот это работает как часы... :
begin
if Sender is TM_Object then
with Sender as TM_Object do
if VariableEx.AsBool = false then
Color := clRed
else
if AsBool = false then
Color := clYellow
else
Color := clGreen
end.
... а это не работает :(
begin
if Sender is TM_Object then
with Sender as TM_Object do
if VariableEx.AsBool = false then
Color := clRed; Alarm_Win.ShowClient(GetClientName); PlayUserSound(GetClientName,'03281.ogg',True);
end. else
if AsBool = false then
Color := clYellow; Warning_Win.ShowClient(GetClientName); PlayUserSound(GetClientName,'02072.ogg',True);
end. else
Color := clGreen;
end.
В чем засада? Спасибо.
Как мы уже написали в сообщении выше: если нужно выполнить несколько действий, то просто заключите их в begin...end. Правильный вариант Вашего скрипта:
begin
if Sender is TM_Object then
with Sender as TM_Object do
if VariableEx.AsBool = false then
begin
Color := clRed;
Alarm_Win.ShowClient(GetClientName);
PlayUserSound(GetClientName,'03281.ogg',True);
end else
if AsBool = false then
begin
Color := clYellow;
Warning_Win.ShowClient(GetClientName);
PlayUserSound(GetClientName,'02072.ogg',True);
end else
Color := clGreen;
end.