8 Replies Latest reply on Dec 14, 2013 11:35 PM by weldon

    Popup checkbox selection window in Find mode

    weldon

      We have a "project" record with multiple selections for a few fields like technologies, industries, solution types, etc. It is possible to make multiple selections from a value list of technologies, for example.

       

      To make it a little easier, these fields are edit boxes on the detail view. However, when you click on them to edit, a script opens a pop-up window with a different layout that shows that field as checkboxes. This makes it easy to read the list of selected entries for each field, without cluttering the main window with all the possible choices. When you want to edit, you get a nice pop-up window with all the checkboxes to choose from. As you check boxes, the edit field on the main window updates. It works great in Browse mode.

       

      When I move into Find mode, the button still creates the window with the checkboxes, but making changes here doesn't save the changes back to the main window in find mode. What I'd like to do is click the field, create a new window with the checkboxes for that field, make some selections and then close the window with those selections represented in the find criteria in the main window. I don't want it to perform the search until I am finished making all my selections.

       

      Here is the script that runs when I click on the edit field in browse mode…

       

       

      Freeze Window
      Commit Records/Requests

      [ No dialog ]
      Set Variable [ $win_name; Value:"Choose Technologies" ]
      Set Variable [ $win_left; Value:Get ( WindowLeft ) ]
      Set Variable [ $win_height; Value:Get ( WindowHeight ) ]
      If [ PatternCount ( WindowNames ( Get (FileName )); $win_name ) ]

      Select Window [ Name: $win_name; Current file ] Else

      New Window [ Name: $win_name; Height: 211; Width: 175; Left: $win_left; Style: Document; Close: “Yes”; Minimize: “Yes”; Maximize: “Yes”; Zoom Control Area: “Yes”; Resize: “Yes” ]

      Go to Layout [ “Asset Technologies” (assets) ] End If

      Show/Hide Toolbars

      [ Hide ]

      Adjust Window

      [ Resize to Fit ]

       

        • 1. Re: Popup checkbox selection window in Find mode
          Mike_Mitchell

          What about setting a variable equal to your selections and then triggering a script when you close the window? Such script would enter Find mode, set the checkbox field equal to the variable, and perform the Find.

           

          Mike

          • 2. Re: Popup checkbox selection window in Find mode
            DavidJondreau

            I know that in Browse mode, different windows have different found sets. I'm guessing in Find mode, different windows are "independent".

             

            Instead of making a new window, how about just switching layouts? If having the background window is important, you could make a new window and have *that* be the background, switching layouts on the original window (resizing, etc as necessary). Then reverse the process.

            • 3. Re: Popup checkbox selection window in Find mode
              weldon

              I would like to make multiple selections in multiple fields before performing the search, so I worry that I will need to maintain a lot of state information in the script.

              • 4. Re: Popup checkbox selection window in Find mode
                weldon

                This might be a good place to use "hidden tabs" on the interace to overlay the checkbox selection when the user clicks on that field. I've not used this technique before, but I've been reading a bit about it this week.

                • 5. Re: Popup checkbox selection window in Find mode
                  keywords

                  I would like to make multiple selections in multiple fields before performing the search, so I worry that I will need to maintain a lot of state information in the script.

                   

                  Why not perform the first Find as suggested by Mike, then perform subsequent Finds using Extend or Constrain as appropriate?

                  • 6. Re: Popup checkbox selection window in Find mode
                    ChadAdams

                    The find request is independent for each window that is open.  In browse mode you are changing the data, so you see it happen in the other window.  In find mode you are entering a request and FileMaker doesn't tranisition that request back to your other window for you. 

                     

                    When you close the pop up window, do you use a button on the layout, or the build in close button provided by the OS?  To do what you want, you'll need to create a script that runs when you close that window that moves your find request info back to the other window for you.  If you are using a close window button then you can tie into that script.  If you are using the OS button (red X in the top left or right corner, depending on OS), then you'll have to use a custom menu to tie your script into that process.

                     

                    The script would look something like this (sudo FMP steps below):

                     

                    Check for Mode (Get (WindowMode) function)

                    If in Find Mode

                      write data you care about to a variable(s)

                       close window

                       write data into correct fields from variable(s)

                          assumes you are now in the correct window, but you may want to make sure by selecting

                       perform find

                      Else

                      Close window

                    End if

                     

                    Also I'd want to make sure the users can't close the window without using your script, so I'd use the Advanced Window Style Options to make it a "Dialog Window (Modal)".  If you are not using FMP 12 or later then you can get a similar behavior with a paused loop (this can bring it's own dificulties so proceed with caution).

                     

                    Hope that helps.

                     

                    Chad

                    1 of 1 people found this helpful
                    • 7. Re: Popup checkbox selection window in Find mode
                      keywords

                      Further to the above, just as Chad points out that the find is independent for each window, so is the mode—you can have one window in Browse mode and another in Find mode. Hence, in the script sequence suggested you would need to insert between these two steps:

                       

                      close window

                      write data into correct fields from variable(s)

                       

                      … an Enter Find Mode step as you will now be back in your original window. Without this you could end up changing data if you have left the original window in Browse mode.

                      1 of 1 people found this helpful
                      • 8. Re: Popup checkbox selection window in Find mode
                        weldon

                        Turns out that popover buttons in v13 do exactly what I want. I placed a transparent popover button over the edit box that then displays the checkbox of the same field. When you make changes, the edit box is updated as it is referencing the same field. Since you are still on the same layout and the same record, Find Mode works as expected here too. You click on the box, the popover button displays the checkboxes, you can make your selections here, move on to another field, and then perform the find.