3 Replies Latest reply on Feb 24, 2014 5:06 PM by Ward

    Can a script scroll an Edit Box to a specific position?

    Ward

      I have a text field displayed in an Edit Box. Since this field can have hundreds of lines of text, perhaps even a couple thousand lines, the Edit Box has a a vertical scroll bar.

       

      A user looking for specific text can manually the scroll the Edit Box. But this becomes virtually impossible when there's a LOT of text.

       

      I'd like to add a text search feature at the top of the Edit Box, something analogous to a Find on a browser page. FileMaker provides key components of such a text search:

       

      • The PatternCount function can determine the number of occurrences of the search string.
      • The Position function can find the locations of these occurrences.
      • A Script Trigger on the search Edit field could even perform search-as-you-type.

       

      Unfortunately, I've not found a way to scroll an Exit Box from a script. Am I missing something obvious? Is there anything in vanilla FileMaker or a third-party plug-in that will help?

       

      -- Ward

        • 1. Re: Can a script scroll an Edit Box to a specific position?
          DrewTenenholz

          Ward --

           

          The only step that jumps to mind is Scroll Window (To Selection) which implies that you must use Set Selection () and find a way to count through to the requested 'occurrence' of the searchText.

           

          Take a look at Ray Cologon's HiLite Text custom function, which might be helpful to you. http://www.briandunning.com/cf/13

           

          -- Drew Tenenholz

          1 of 1 people found this helpful
          • 2. Re: Can a script scroll an Edit Box to a specific position?
            jwmickelson

            Hi Ward,

             

            Yes, you can.  Use a script with two script steps:

             

            - Go to Field  [ Table::FieldYouSearch ]

            - Perform Find / Replace [ Table::YourGlobalSearchField ; Find Next ]

             

            It will scroll the field to the text match.  You could obviate the need for this much complexity and give them a "find" button which pops up the native search / replace dialog... it's so similar to what's in other word processing apps, most people will understand it, but it does have scripted options that can limit their earch to find's only, which is nice.

             

            Best,

            Jonathan

            • 3. Re: Can a script scroll an Edit Box to a specific position?
              Ward

              As the name implies, the Scroll Window script step applies to an entire FileMaker window, not a specific Edit Box.

               

              Ray's HiLite Text custom function appears to offer the ability to make the search text stand out, which should make manual scrolling more feasible.  For example, on a Mac, Safari's Find highlights all occurrences of the search string.  I sometimes scroll the browser window instead of using the keyboard shortcut for Find Next.

               

              Thanks, Drew, for the link to Ray's promising function.

               

              It would still be great to find a way to automate Edit Box scrolling.

               

              -- Ward