Closing panel - How to allow threads to complete instead of interrupting them

Find and share HowTos to various installations / configurations!
Search

Post Reply
6 posts • Page 1 of 1
slamkwon
Posts: 18
Joined: Wed Oct 10, 2018 12:20 am

Closing panel - How to allow threads to complete instead of interrupting them

Post by slamkwon » Wed Sep 04, 2019 4:54 am

Hi all,

I'm wondering:

Once a panel is opened and a script is run
if there is a way to allow threads to be completed once clicking the red close button on the title bar.

Currently, when closing a page the event 'terminate' is triggered and all threads are interrupted.
Is there a function that triggers a wait for the threads to complete? (ie. waitThread(Thread1 ID), waitThread(Thread2 ID), )

The current solution I know is to turn off title bars and making a separate close button that forces the threads to close manually, but this doesn't work if the panel is force closed with a CTRL-F4 (same as pressing the X on the title bar).

Could someone help me with this?

buec
Posts: 14
Joined: Tue Dec 07, 2010 2:09 pm

Re: Closing panel - How to allow threads to complete instead of interrupting them

Post by buec » Thu Sep 05, 2019 5:57 am

Try the panel 'close' event.
On the end of the close script, you have to close the panel with PanelOff( ).

User avatar
leoknipp
Posts: 1891
Joined: Tue Aug 24, 2010 5:28 pm

Re: Closing panel - How to allow threads to complete instead of interrupting them

Post by leoknipp » Thu Sep 05, 2019 6:40 am

If you have threads which should be finished independent of a user interface or a specific panel you should think about executing these actions in a CTRL manager on the server.
The UI will just send the command to the CTRL manager which then executes the script.

The same solution is used in many functionalities in WinCC OA.

Best Regards
Leopold Knipp
Senior Support Specialist

slamkwon
Posts: 18
Joined: Wed Oct 10, 2018 12:20 am

Re: Closing panel - How to allow threads to complete instead of interrupting them

Post by slamkwon » Tue Sep 10, 2019 12:13 am

buec wrote:
Thu Sep 05, 2019 5:57 am
Try the panel 'close' event.
On the end of the close script, you have to close the panel with PanelOff( ).
In the example of dpConnect() this works fine, however when closing an Embedded Module the Close event doesn't work.
Do you know a work around for this?

User avatar
leoknipp
Posts: 1891
Joined: Tue Aug 24, 2010 5:28 pm

Re: Closing panel - How to allow threads to complete instead of interrupting them

Post by leoknipp » Tue Sep 10, 2019 6:54 am

The "Close" event is part of the panel and not of a module.
The module is just the container for a panel.

What is meant with "closing an embedded module"?

Best Regards
Leopold Knipp
Senior Support Specialist

slamkwon
Posts: 18
Joined: Wed Oct 10, 2018 12:20 am

Re: Closing panel - How to allow threads to complete instead of interrupting them

Post by slamkwon » Wed Sep 11, 2019 1:04 am

Hi Leopold, I should have been clearer.

When closing a panel within an Embedded Module, the close event isn't triggered. This was verified using DebugN; no event occurs in the log viewer during the close.
However, when closing a panel NOT embedded, the close event works fine and the results are visible in the log.

Hope this clarifies.

Post Reply
6 posts • Page 1 of 1