football predictionswww.betips.co.ukfootball betting tips

Truly Custom Dialog box with multiple records and related data in FileMaker

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:

  1. Create your layout to display the data.
    1. Layout should be list view
    2. Note the height and width of the new layout for 1 record
  2. Have initial script run
  3. When the initial script needs the custom dialog which was entered with an If script step the following script steps happen.
    1. Set Variable:  Set a variable containing the width of the new layout.  This will be used for centering the new layout over the layout.
    2. New Window:
      1. Label the window.  I used a variable ( $title ) so that I could reuse it when I use the close window script step.
      2. 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.
      3. I set the distance from top to zero to allow for the most number of records to be seen.
      4. 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:
        1. If I need to tweak it in the future I will only have to change the number in one place instead of two.
        2. It is easier to see in the ScriptBuilder
        3. Variables are cool 🙂
          1. So cool in-fact that I decided to set the height with one as well for consistency.
  4. picture-35

  5. I then enter a loop.  This keeps the user from doing anything else until they make a selection
  6. 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.
  7. 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.
    1. I reused the window name variable ( $title) I had previously used to name the specific window to close.
    picture-37

Leave a comment