Strategy for pausing a method

Since we can not pause a method, can someone suggest a clever strategy for doing the following:

  • Show a dialog that instructs the user to select the starting record in a list view (vStartIndex)

  • User selects the starting record (vStartIndex is set)

  • Show a dialog that instructs the user to selet the ending record in a list view (vEndIndex)

  • User selects the ending record (vEndIndex is set)

Now I can loop through the set of selected records and do what I need to do.

Out of curiosity: how would it work with ‘pause’ functionality?

I should have mentioned that I am aware of using the ShowFormInDialog approach, where I would have perhaps three methods:
1: Show first form in dialog and allow the user to select the starting index
2. Show the second form in dialog and allow the user to select the ending index
3. Loop through the records

Just wondering if there was any other approach I was unaware of.

The only other way I can think of (hypothetically speaking), instead of using the ShowFormInDialog method, would be to use the FMP approach:

  • Show the first dialog instructing the user to select the starting record
  • User clicks “Okay” to dismiss the dialog
  • The method is “paused” while the user now selects the record
  • The user then hits the “Enter” key or the CONTINUE button displayed in the editor
  • The method resumes running and typically validates what the user did before showing the next dialog

I suppose a better way might be to have the ability to WAIT for a form event to fire, such as onRecordSelection, onDataChange, etc., then continue running the method. But, I don’t think we can at all trap for events programmatically, and I’m not sure you need to unless you could WAIT for something to happen. Feature request?

I do think you could use the onDataChange event.

Create a global to tell the solution what you are doing, check for the global onDataChange and fire whatever it is that needs to be fired…

I’d do it this way:

  • add button to tableview
  • show non-modal dialog: select first record, user hits button in first to be selectd record, you set a global with the first recordid.
  • Change text in non-modal dialog to read: now select the last record
  • user hits select record in listview, over to your loop