Error message form

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
This topic is 12 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Error message form

Post by R1Johnny »

Good morning,I'd like to create a very simple form with just a Label inside.I'd like that form to be called by another script in the event of an error.This form would stay open for viewing for 5-7 seconds, then close and return to the calling script.The only thing I haven't solved yet is where to put my start-sleep statement followed by my form.close() statement.Could you please advise.Thank you.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Error message form

Post by davidc »

You need to add a Timer Control, which you can have trigger the form closure after a specified amount of time. Please see the Spotlight on the Timer Control blog article for more details.If you use the start-sleep it will freeze the form and possible prevent it from displaying the label. David
David
SAPIEN Technologies, Inc.
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Error message form

Post by R1Johnny »

Nope. No go on this one. Blog didn't have enough info. No details for what I want. Tried to piece together something based on it but no use.Here's my code:$labelTest_Click={ #TODO: Place custom script here $totaltime = 7 $script:starttime = (Get-Date).addseconds($totaltime) $timer1.Start()}$timer1_Tick={ #TODO: Place custom script here [timespan]$span = $script:starttime - (Get-Date) if($span.TotalSeconds -le 0){ $timerupdate.stop() } $form1.Close()
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Error message form

Post by davidc »

Set the timer's interval property so it is 6 seconds (6000) and on the Tick event you simply close the form: $timer1_Tick={ $form1.Close()}
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Error message form

Post by davidc »

And start the timer on the Form's Load event.
David
SAPIEN Technologies, Inc.
User avatar
R1Johnny
Posts: 37
Last visit: Mon Dec 12, 2022 7:15 am

Error message form

Post by R1Johnny »

Ahhh. That was perfect. Thank you very much once again. And so much simpler that what I was trying to do.Sorry about the brevity in my previous comments. Deadlines and pressures.Apologies.
This topic is 12 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.