12 Replies Latest reply on Sep 26, 2015 12:20 PM by fclark

    Set selection misbehavior gaining access to field

    fclark

      I am trying to use the script step "set selection" in a popup. That script step closes the popup and activates a field (a corresponding field on the underlying layout.) ... That underlying field is not permitted browse or find access. Yet it activates that field and can then be edited.

        • 1. Re: Set selection misbehavior gaining access to field
          erolst

          Is there a question in your post?

          • 2. Re: Set selection misbehavior gaining access to field
            fclark

            I was attempting to "report a product issue"

            Gaining access to a field that is not enterable in browse or find mode using set selection in a popup seemed a bug. Is there a way to prevent that behavior? I tried going to the object without success?

            • 3. Re: Set selection misbehavior gaining access to field
              erolst

              fclark wrote:

              Gaining access to a field that is not enterable in browse or find mode using set selection in a popup seemed a bug

               

              Not really, since the access is gained by a script step, which means that this behaviour is under your control. Also, why set a selection if the field cannot be entered to edit its value?

               

              If you only want to change the field's value, you may want to try Set Field[], which will not enter the field.

              • 4. Re: Set selection misbehavior gaining access to field
                fclark

                Fair enough. On it not being a bug.

                my pop up shows a text log. Which is an expanded view of the underlying field.

                From this pop up I want to time stamp the note and put the cursor after the time stamp. The set field works as expected the following set selection step closes the pop up and jumps into another field. I have tried to go to the object but that does not keep the pop up from closing.

                • 5. Re: Set selection misbehavior gaining access to field
                  erolst

                  Care to show your script?

                  • 6. Re: Set selection misbehavior gaining access to field
                    fclark

                    where "PP" is the paragraph operator

                     

                    Allow user abort [off]

                    freeze window

                    set field[database::note;get(currentTimestamp)&": "&"PP"&database::note]

                    Go to Object [object Name: "object_notePopup"]

                    set Selection [database::note;Start position: Position (database::note;"PP";1;1)]

                    Exit Script

                    • 7. Re: Set selection misbehavior gaining access to field
                      erolst

                      Are we really talking about a pop-up? I believe you mean a pop-over control.

                       

                      I think the problem is that you have the same field twice on the layout, and “Set Selection” targets the first instance which is not the one on the pop-over – so to “go there”, the pop-over must be closed.


                      Try “Set Selection” without specifying a target field – you already have gone to that field via Go to Object (or if object_notePopup is not the edit field, give it an object name and use that):

                       

                      Allow user abort [off]

                      Set Field [ database::note ; Get ( CurrentTimestamp ) & ": ¶¶" & database::note ]

                      Go to Object [object Name: "object_notePopup" ]

                      Set Selection [ no target field; Start position: Position ( database::note ; "¶¶" ; 1 ; 1 ) ]

                      Exit Script

                      • 8. Re: Set selection misbehavior gaining access to field
                        fclark

                        Thanks for your generous guidance. I have created a test file to eliminate some of the extraneous factors and incorporated your suggestion of the removal of the target field. I got it to work in the test file.

                         

                        Using my original file I get the following.... The go to object step fails - error 3 command is unavailable.  wrong operating system / mode. (this seems pretty weird.) So while the set script step was part of the problem it is only part of the problem.

                         

                        Can the classic theme be a factor? now that it is not longer supported?

                        • 9. Re: Set selection misbehavior gaining access to field
                          erolst

                          fclark wrote:

                          Using my original file I get the following.... The go to object step fails - error 3 command is unavailable.  wrong operating system / mode.

                           

                          Can the classic theme be a factor? now that it is not longer supported?

                          Well, that's odd.


                          Maybe create a duplicate of layout, switch to a “real” theme and try the script again?

                          • 10. Re: Set selection misbehavior gaining access to field
                            fclark

                            Your comment about how FileMaker may select the field got me to try just changing the order of objects on the page. The hypothesis being , objects added on the layout later would be evaluated in that creation order. It worked.

                             

                            I fixed the problem by selecting the Note field -> Cut, Paste.

                             

                            The original script worked. I did not know the importance of object order.

                             

                            Thanks for your help.

                            • 11. Re: Set selection misbehavior gaining access to field
                              erolst

                              fclark wrote:

                               

                              Your comment about how FileMaker may select the field got me to try just changing the order of objects on the page. 0

                              […]

                              The original script worked. I did not know the importance of object order.

                               

                              Since you cannot see the z-order anywhere, it seems best not to rely on the order identical fields were added, and rather use explicit navigation via object names.

                              • 12. Re: Set selection misbehavior gaining access to field
                                fclark

                                My error 3 messages persisted on the go to object script step. No matter what name I used to call the field object I got error 3. Deleted that field off  the layout and inserted a new one. Back in business. The field was damaged?