App Developer Runtime close with a command

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Post Reply
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Flowcode v10 App Developer Runtime close with a command

Post by stefan.erni »

Hi Ben

Is there a way to close the FC10 Runtime.exe with a command in the App?

Or is there a way to prevent the app from closing before data is saved or a stop command is sent to a machine?

In the simulation it's working with a while loop and a end switch

regards

Stefan

Steve-Matrix
Matrix Staff
Posts: 1252
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: App Developer Runtime close with a command

Post by Steve-Matrix »

Hi Stefan,

There is no easy way to programmatically close a Flowcode App Developer app. I will add to my list to investigate.

But there is a way to prevent the app from closing (although the user can override this by pressing 'ignore' when the warning appears).

I have attached a simple app and project to show this behaviour. The Event you need is "Components.ProjectClosedown", and returning a non-zero value from this event will show the warning message.
Attachments
shutdowntest.fcsx
(14.69 KiB) Downloaded 50 times
shutdowntest.mscada
(4.32 KiB) Downloaded 45 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer Runtime close with a command

Post by stefan.erni »

Hi Steve

Very good !

I will use this into my programs for now.
I would like to test later when you have new commands to close the app.

Just a little remark
Unfortunately, this small square stops immediately but the user should not use this.

regards

Stefan
Attachments
Snag_102647.png
Snag_102647.png (133.21 KiB) Viewed 1137 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: App Developer Runtime close with a command

Post by BenR »

Hi Stefan,

There is a Simulation Stop event that you could use to catch users clicking the stop button, In the event macro you could either restart the sim or close the app.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: App Developer Runtime close with a command

Post by stefan.erni »

Hi Ben

Yes, I understood a little but not completely.
The input Message window opens but the program is already closed.

Does that have something to do with the error message? I choose yes then the input Message windows open

But there is no count/down or count/up

regards

Stefan
Snag_174b043.png
Snag_174b043.png (11.63 KiB) Viewed 1123 times
Snag_17521aa.png
Snag_17521aa.png (8.78 KiB) Viewed 1123 times
Attachments
FC10_post_stop1.fcsx
(18.09 KiB) Downloaded 45 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: App Developer Runtime close with a command

Post by BenR »

Hello,

You can't really have blocking code inside the event macro but I have edited the stop macro so that now it just starts the sim running again. Hopefully helps to avoid the user clicking that pesky stop button.
FC10_post_stop1.fcsx
(11.22 KiB) Downloaded 45 times
You might need to check that variable values aren't reset and if they are then you might need to store them in the stop event and restore them after.

Steve-Matrix
Matrix Staff
Posts: 1252
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: App Developer Runtime close with a command

Post by Steve-Matrix »

If you don't want the "stop" button in a deployed app, select ""no controls" or "start/pause" under "execution controls" when deploying it.

Post Reply