6 Replies Latest reply on Aug 31, 2010 11:06 AM by TSuki

    Set Selection doesn't scroll when used in a script

    ryanelsemore_1

      Summary

      Set Selection doesn't scroll when used in a script

      Product

      FileMaker Pro

      Version

      FM 11 Adv

      Operating system version

      Windows XP

      Description of the issue

      The set selection function is supposed to scroll down if need be to reveal the selected text.   While I can get this to work with a button assigned just this function, I cannot get it to scroll when used in a script. 

      The script sets the field in question, then is supposed to set selection to bring the user to the area of the text they just added to.  I've tried every combo of commit record, etc etc

        • 1. Re: Set Selection doesn't scroll when used in a script

          ryanelsemore:

          Thank you for posting.

          What else does the script in question do? Be careful that there are no steps similar to Freeze Window.

          What happens if you add an explicit Scroll Window [To Selection] step as well?

          TSuki
          FileMaker, Inc.

          • 2. Re: Set Selection doesn't scroll when used in a script
            philmodjunk

            I can replicate this behaviour with a very simple script in Windows XP and FileMaker 11.02 with no extra steps. Just a single set Selection step. What I can't do is get this to work any differently with a button--that also fails to scroll the window for me.

            • 3. Re: Set Selection doesn't scroll when used in a script

              PhilModJunk:

              Thank you for posting your test results. I tested on my Windows XP machine and only seemed to get the issue when I ran the script while the field in question was selected.

              ryanelsemore:

              Does the script function any differently when a Commit Records/Requests step is used just before the Set Selection step?

              My current setup includes a large text field and a script. The script appends text to the end of the field using Set Field and then moves the cursor to the end of the field with a Set Selection step:

              Set Selection [field1; End Position: Length(field1)]

              If the script is run while the field is already selected, no scrolling occurs.

              TSuki
              FileMaker, Inc.

              • 4. Re: Set Selection doesn't scroll when used in a script
                philmodjunk

                That motivated me to do a bit more testing. Since the help file says that Data selected out of visual range is scrolled into view, I've been testing with a 2 line field formatted with a scroll bar. 2 lines of text are entered in the test field so that any additional lines will not be visible unless the field is either scrolled or popped out. The test script uses set field to append data from a second field to the end of the test field and then uses set selection to select the newly appended text. This does not scroll the text.

                If I remove the scroll bars, the field pops out and exposes the selected text. That's not how I define "scroll", but it does expose the selected text. Whether the cursor is in the test field, in the new text field or not in any field does not appear to change the script's behavior.

                • 5. Re: Set Selection doesn't scroll when used in a script
                  ryanelsemore_1

                  I'm working with a text field with 20,000 + characters.

                  The only way I can get Set Selection to scroll is by assigning it to a button and going to a predetermined spot.  And this only works if the field is not active when the button is pressed.  If the cursor is in the field, it doesn't scroll.

                  I wanted to use the function to return the long text field to the cursor location after a button was pressed (Insert Text at Cursor Location script).  When used in the script, I cannot get Set Selection to scroll at all.  Doesn't matter if I use a fixed location or a variable.  Also tried to commit record before, that doesn't help.  (of course, I didn't want to have to specify the field for Set Selection, I just wanted it to set selection in my active field since I wanted to use the same script for a variety of fields)

                  What does work is the Scroll Window function.  When I use Scroll Window to Selection in the script, it achieves the effect I was looking for.  Insert text at cursor, then scroll the window to the original cursor location.

                  All of this is just to mimic having the scroll bar on a text field remain where it is, as can be done with a portal.

                  So I'd say that it definitely doesn't work properly, but by using the additional Scroll Window function, the same effect can be achieved. 

                   

                  • 6. Re: Set Selection doesn't scroll when used in a script


                    PhilModJunk:

                    I misunderstood that the issue was with field scrolling, not window scrolling. I tried doing the above with a scrollbar enabled on the field and got the same result you did.

                    ryanelsemore:

                    Curiously, the Scroll Window step also appears to trigger the necessary field scrolling as well. I will investigate whether this issue is intended behavior or not.

                    TSuki
                    FileMaker, Inc.