I created a popup screen and open it with the code:
Globals.MyScreen.Show();
How can I close the screen using script?
regards, Waldemar
How to close screen with script?
Re: How to close screen with script?
Globals.MyScreen.Close();
Br.
Br.
Re: How to close screen with script?
Thank You Edmund, works fine! What is confusing, every time when HMI power up, the new popup screen appears. How can it be prevented?
Regards, Waldemar
Regards, Waldemar
Re: How to close screen with script?
From where do you call your ".Show();" code?
Br.
Br.
Re: How to close screen with script?
It is calling from 2 places:
1. Button "Record data to USB", placed on the screen "Statistic".
2. Tags>Scripts> aTag's_ValueOn, when 2 other tags meet conditions.
1. Button "Record data to USB", placed on the screen "Statistic".
2. Tags>Scripts> aTag's_ValueOn, when 2 other tags meet conditions.
Re: How to close screen with script?
It´s probably the second one that fires of the event.
Could you copy and paste the code here?
Best Regards
Could you copy and paste the code here?
Best Regards
Re: How to close screen with script?
void Stopping_state_ValueOn(System.Object sender, System.EventArgs e)
{//record trend to USB when the system stops
Globals.Tags.Last_session_number.Value=0;
if (Globals.Tags.History_trend_recorded.Value==false)
{
Globals.ExportTrendData.ExportTrend("Datalogger1"); Globals.Tags.History_trend_recorded.Value=true;
}
Globals.Tags.Session_number_after_record.Read();
if (Globals.Tags.Session_number_after_record.Value>63&Directory.Exists("\\Hard Disk"))
//if 64 sessions made after last record to USB and USB memory available
{
Globals.USB_record.Show();
}
}
{//record trend to USB when the system stops
Globals.Tags.Last_session_number.Value=0;
if (Globals.Tags.History_trend_recorded.Value==false)
{
Globals.ExportTrendData.ExportTrend("Datalogger1"); Globals.Tags.History_trend_recorded.Value=true;
}
Globals.Tags.Session_number_after_record.Read();
if (Globals.Tags.Session_number_after_record.Value>63&Directory.Exists("\\Hard Disk"))
//if 64 sessions made after last record to USB and USB memory available
{
Globals.USB_record.Show();
}
}
Re: How to close screen with script?
I would start by adding another & in your if-clause.wlederer wrote: if (Globals.Tags.Session_number_after_record.Value>63&Directory.Exists("\\Hard Disk"))
//if 64 sessions made after last record to USB and USB memory available
{
Globals.USB_record.Show();
}
}
AND = '&&'
OR = '||'
NOT = '!='
Is it possible that the conditions are true at startup?
Re: How to close screen with script?
Thank You Bjornidar.
I deleted the screen and added it again. The problem disappeared. Don't know the reason.
What is the difference between "&" and "&&"?
I deleted the screen and added it again. The problem disappeared. Don't know the reason.
What is the difference between "&" and "&&"?
Re: How to close screen with script?
I know..Old thread..but..
Can someone help a c# newbie with a code that close a popup screen when a tag goes from false to true or like close a specified screen when a alarm goes from active to inactive???
I came up with this, but not working..
Should I put the script in the screen i want to close?
namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;
public partial class Nodstop
{
void Nodstop(System.Object sender, System.EventArgs e)
{
if (Globals.Tags.Application_GVL_MEMORY_Nodstopp.Value=1)
Globals.Nodstop.Close();
}
}
}
Can someone help a c# newbie with a code that close a popup screen when a tag goes from false to true or like close a specified screen when a alarm goes from active to inactive???
I came up with this, but not working..
Should I put the script in the screen i want to close?
namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;
public partial class Nodstop
{
void Nodstop(System.Object sender, System.EventArgs e)
{
if (Globals.Tags.Application_GVL_MEMORY_Nodstopp.Value=1)
Globals.Nodstop.Close();
}
}
}