Skip to main content
18-Opal
December 18, 2024
Question

About the pause function for repetitive tasks

  • December 18, 2024
  • 2 replies
  • 1593 views

Hi,

I am trying to implement a repetitive tasks that opens a listed drawing in a new window and exports it in a different format. and that it can be stopped during repetitive tasks.

 

Work scenario)

The repetitive tasks is implemented with a "for" loop, and the task of opening and exporting the drawing is temporarily implemented with the "EmptyWindowCreateAndDelete" function.

 

use a window procedure to respond to the user to stop during the task. When the window procedure window is closed, the loop stops.

 

This function is effective in loops. The TEST2 function works only with the loop without EmptyWindowCreateAndDelete, and when the user closes the window, the loop seems to stop in the middle.

However, when used with a function that creates a new window like EmptyWindowCreateAndDelete, the window procedure does not respond to the user's click.

Is there a better way to stop during the looping task, or is there a way to make the window procedure respond to the user's click even when a new window is created?

 

Note. I have attached the video and the entire code.

2 replies

17-Peridot
December 19, 2024

You may need to activate the dialogue in the for loop to allow the X button to be clicked. It looks like you're creating your UI using a Windows Form, so I'm not exactly sure how to do this.

I normally create Creo Toolkit UIs using the CreoUIEditor and then use ProUIDialogActivate in the for loop to activate the dialogue to allow the buttons to be clicked. In Creo 10, you can find the CreoUIEditor here: "C:\Program Files\PTC\Creo 10.0.X.0\Common iles\applications\creouieditor\bin\creo_ui_editor.bat".

 

Using ProUIDialogActivate in the for loop has a lot of benefits:

  • User can click the Stop or X buttons to exit the for loop.
  • Status and progress bar updates can be given to the user.
  • Without using ProUIDialogActivate, Creo will often just enter a busy "spinning circle" mode until the for loop completes and ProMessageDisplay stops working to give the user status updates. There may be some other way to get ProMessageDisplay to reliably work in for loops but using ProUIDialogActivate has worked for me.

Here's an example:

lhoogeveen_0-1734628970727.png

CHASEONHO18-OpalAuthor
18-Opal
December 27, 2024

@lhoogeveen Thanks your reply, 

but, Our tool is synchronous toolkit and in this case I cannot click a button in the middle of a FOR-LOOP.

17-Peridot
December 30, 2024

Our Toolkit applications are all synchronous and the method above works just fine.

18-Opal
December 20, 2024

Why not a-synchronous with hidden graphics, next a simple button for stop?