Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: How to close screen with script?
PostPosted: Wed Apr 02, 2014 4:23 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 161

Offline
I created a popup screen and open it with the code:

Globals.MyScreen.Show();

How can I close the screen using script?

regards, Waldemar


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Wed Apr 02, 2014 9:47 am 
User avatar

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

Offline
Globals.MyScreen.Close();

Br.

_________________
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Thu Apr 03, 2014 1:38 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 161

Offline
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


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Mon Apr 07, 2014 9:28 am 
User avatar

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

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

Br.

_________________
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Tue Apr 08, 2014 2:25 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 161

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


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Tue Apr 08, 2014 7:53 am 
User avatar

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

Offline
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


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Thu Apr 10, 2014 9:31 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 161

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


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Wed May 14, 2014 7:37 am 

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

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


 Profile  
 
 Post subject: Re: How to close screen with script?
PostPosted: Wed May 28, 2014 8:27 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 161

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


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: