I was challenged with creating a pop-up dialog box containing information from multiple records and related data.  Obviously a “Show Custom Dialog†script step would not work.
Solution:
- Create your layout to display the data.
- Layout should be list view
- Note the height and width of the new layout for 1 record
- Have initial script run
- When the initial script needs the custom dialog which was entered with an If script step the following script steps happen.
- Set Variable:  Set a variable containing the width of the new layout.  This will be used for centering the new layout over the layout.
- New Window:
- Label the window.  I used a variable ( $title ) so that I could reuse it when I use the close window script step.
- The prompt for my situation was when there were one or more records that needed chosen.  That is when I set the variable $record_count.  I set the height of the window based on the number of related records.  This is done by multiplying the $record_count by the height of one record on the new layout.
- I set the distance from top to zero to allow for the most number of records to be seen.
- Distance from left was set using the previously set $dialog_width variable and the Get (ScreenWidth) function. Â Basically I divided the width of the screen and then subtracted half the width of dialog box. Â This centers the box on the screen. Â I could have just typed the numbers in but decided to use the $dialog_width variable for three reasons:
- If I need to tweak it in the future I will only have to change the number in one place instead of two.
- It is easier to see in the ScriptBuilder
- Variables are cool 🙂
- So cool in-fact that I decided to set the height with one as well for consistency.
- I then enter a loop. Â This keeps the user from doing anything else until they make a selection
- On the custom dialog I have two buttons.  When either selection is chosen it sets a variable to 1.  This is looked at every 1 second by using a Pause/Resume Script and specifying 1 second duration.  The Exit Loop If step looks for either variable to be set to one.
- Using If and Else If script steps  you can  choose what action to take based on which global variable is set to 1.  In my case, when $choice_1 is set to 1 then a script will be performed.  If $choice_2 is 1 then the new window is closed and the script is exited.
- I reused the window name variable ( $title) I had previously used to name the specific window to close.