Page 1 of 1
How to close screen with script?
Posted: Wed Apr 02, 2014 4:23 am
by wlederer
I created a popup screen and open it with the code:
Globals.MyScreen.Show();
How can I close the screen using script?
regards, Waldemar
Re: How to close screen with script?
Posted: Wed Apr 02, 2014 9:47 am
by Edmund
Globals.MyScreen.Close();
Br.
Re: How to close screen with script?
Posted: Thu Apr 03, 2014 1:38 am
by wlederer
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
Re: How to close screen with script?
Posted: Mon Apr 07, 2014 9:28 am
by Edmund
From where do you call your ".Show();" code?
Br.
Re: How to close screen with script?
Posted: Tue Apr 08, 2014 2:25 am
by wlederer
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.
Re: How to close screen with script?
Posted: Tue Apr 08, 2014 7:53 am
by Edmund
It´s probably the second one that fires of the event.
Could you copy and paste the code here?
Best Regards
Re: How to close screen with script?
Posted: Thu Apr 10, 2014 9:31 am
by wlederer
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();
}
}
Re: How to close screen with script?
Posted: Wed May 14, 2014 7:37 am
by bjornidar
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();
}
}
I would start by adding another & in your if-clause.
AND = '&&'
OR = '||'
NOT = '!='
Is it possible that the conditions are true at startup?
Re: How to close screen with script?
Posted: Wed May 28, 2014 8:27 am
by wlederer
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 "&&"?
Re: How to close screen with script?
Posted: Tue Feb 21, 2017 1:57 pm
by Magah
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();
}
}
}