How to close screen with script?

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

How to close screen with script?

Post 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

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: How to close screen with script?

Post by Edmund »

Globals.MyScreen.Close();

Br.
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: How to close screen with script?

Post 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

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: How to close screen with script?

Post by Edmund »

From where do you call your ".Show();" code?

Br.
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: How to close screen with script?

Post 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.

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: How to close screen with script?

Post by Edmund »

It´s probably the second one that fires of the event.

Could you copy and paste the code here?

Best Regards
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: How to close screen with script?

Post 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();
}
}

bjornidar
Posts: 49
Joined: Thu Nov 17, 2011 2:10 am
Location: Norway
Contact:

Re: How to close screen with script?

Post 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?

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: How to close screen with script?

Post 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 "&&"?

Magah
Posts: 1
Joined: Sun Feb 19, 2017 4:44 pm

Re: How to close screen with script?

Post 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();
}
}
}

Post Reply