14 Replies Latest reply on Oct 11, 2013 2:36 PM by ChrisJohnston

    Double Clicking a Button

    NicoleJohnson

      Title

      Double Clicking a Button

      Post

      Currently I have two arrows on my page.  One that looks like this ">" and one that looks like this ">>".

      The ">" goes to the next record.

      The ">>" goes to the last record.

      Is there a way that I can just have one button.  If the person clicks the button once, it goes to the next record and if the person clicks the button twice, it goes to the last record.  Is this a feature or are there any workarounds?

        • 1. Re: Double Clicking a Button
          philmodjunk

          There's no built in feature for double clicks, but I have seen a work around: The script captures the current time stamps of the last two times the button was clicked in global fields and responds one way if the difference is less than 1 second (double click) and differently if the difference is 1 second or greater (single click).

          Set Variable [$Click ; Get ( CurrentTimeStamp ) ]
          If [ Not IsEmpty ( $$PrevClick ) and ( $Click - $$PrevClick ) < 1 // double click]
             Go To Record/request/page [Last]
          Else
             #Single Click
             Go To Record/request/page [next]
          End If
          Set Variable [$$PrevClick ; $Click ]

          • 2. Re: Double Clicking a Button
            Jade

            …or use the control key on Mac or the right click on Windows in combination with:

            If(Get(ActiveModifierKeys) = 4)

            else

            end if

            • 3. Re: Double Clicking a Button
              NicoleJohnson

              Thanks! Worked just as you said.

              • 4. Re: Double Clicking a Button
                Sorbsbuster

                Very clever, Phil!

                (But could I chip in about 'Standards' (even if they are 'Perceived Standards')?  I think common usage has made most folks understand that > means 'next record' and >> means 'end record'.  How will you get across to your users that there is even a difference between a single-click and a double-click?  Cos I don't think they'll read the tool-tip...  I more often have almost the opposite problem - users have recently arrived at the interface by double-clicking operating system icons and are so used to that that they can't get in their heads that only a single-click is needed to operate a Filemaker Button.  As you've found, of course, it doesn't usually make any difference.  But there is something in my head that says, "Just because it can be done, doesn't mean you should do it."  I think you'll hear mumblings of users exchanging views that 'Well, it seems to work when I do it..."  Unless I had a really good driving reason, I'd tend to stick with what most people will understand: distinctly different '>' and '>>' buttons.  It's not as if the extra '>>' takes up much space...)

                • 5. Re: Double Clicking a Button

                  _i_ only get one click response !!!! After about 50 failure adjustments !!!

                  How in the heck can one get a double click response from this as it is?

                  It's always going to play out entirely as a one click !!!! Really need this and _i_ can't get it to work !!!!

                  r o b

                  Set Variable [$Click ; Get ( CurrentTimeStamp ) ]
                  If [ Not IsEmpty ( $$PrevClick ) and ( $Click - $$PrevClick ) < 1 // double click]
                     Go To Record/request/page [Last]
                  Else
                     #Single Click
                     Go To Record/request/page [next]
                  End If
                  Set Variable [$$PrevClick ; $Click ]

                  • 6. Re: Double Clicking a Button

                    _i_ disagree with Sorbsbuster

                     

                    As _i_am trying to figure out how in  the world do i double click my button (2x) to do a script to quickly jump me back to home position my main current record of interest.

                    And with a single click from the button, to do a script that walks me backwards through each previous record visited.

                    Let's say your on your main record of interest !! And you leave your record of interest to visit other records on the layout and you want to double click the button to quickly jump back to home position your main record of interest OR single click it for goBack to last previous records visiting each one until you arrive on your current record of interest.

                    Having only ONE button to do THIS is much better than two !!! 


                    However i have not found any double clicking on this script to work for me with  FMA11.

                    r o b 'jesus Land Tidd'  lewis

                    • 7. Re: Double Clicking a Button
                      ChrisJohnston

                           I have a small Notes area in a portal row that I want my users to be able double click on and bring up a more robust Notes area. If they don’t double click I want the same functionality before the script, that was it edited the Notes in place. When I make the area a button it works with double clicking to open the new window (more robust Notes window), but it does nothing when I single click now. I don’t know if this has to be done on a per “what was supposed to happen basis” or if I can just make I Else’s do what you normally did. So my question is can I make my Else do what it normally did or is there more to it. I would like to know because than this Script can always be helpful to do that, what the single click did before adding it. As usual great technique!

                      • 8. Re: Double Clicking a Button
                        Sorbsbuster

                             Chris - I've tried the script that Phil originally suggested (Phil refers to 'global fields' in his text, but I used global variables as per his script) and as soon as I click once the click is registered and that 'one-click' action is executed.  In other words, I can't get it ever to see a double-click - are you able to get to do that?  If so I think it should be easy to get it to do what you ask.

                        • 9. Re: Double Clicking a Button
                          ChrisJohnston

                               Yes! it actually works but I can't get what want. My problem seems to be that I wan the actual text area to be the place where you can click to get this to happen. When I make it a button (off to the side of the area) it works fine. I wonder if the fact that this area is in a portal row has any barring on the status. I am going to play with it some more and see if I can find a work around. Are you saying you never got it to work? I wonder if it is similar to what I am dealing with where what (type of object) you are clicking on interacts with the way the script works. Have you tried it on a making a button away form the object that is not working?

                          • 10. Re: Double Clicking a Button
                            Sorbsbuster

                                 I can't get the single-click / double-click to work.  If I use a script like Phil's and have the two outcomes as a dialogue of "You clicked once" or "You clicked twice" I cannot get it to recognise a double click.  If you have got the click-recognition to work then you are a step ahead of me.

                                 Your two results of the clicks should be:
                                 - go to the last record
                                 or
                                 - go to the 'Notes' field to allow data entry

                                 If you set the script step for outcome 2 to be 'Go To Field - 'Notes' it would nearly work.  But it has to know the correct 'Notes' field to go to.  I would collect the Portal Row clicked on as a $Variable right at the start of the script.  Then, in the If statement result that goes to the Notes field, add two more steps:
                                 - Go To Field [The Portal Relationship::Notes]
                                 - Go To Portal Row [By Calculation = $PortalRow]

                                 You can drive the script to the right portal by naming it as an object, but that will do in the meantime.

                                 So, if you have the ability to distinguish between double- and single-clicks, that should let you branch to going to the last record, or to entering the Notes field.  (One of the problems you could have had was that once a field is defined as a button the user can't click into it to do any data entry.)

                            • 11. Re: Double Clicking a Button
                              philmodjunk

                                   Given the limited real estate available for controls on an iPhone screen (and the need to make these controls extra large for our fat finger tips), I've been considering a revisit of this concept as I'd like to get the same functionality on my iphone screen.

                                   It's lunch time here, so I'm going to feed the beast then play with a demo file to test some ideas that I have. If it works for me, I'll share the demo file.

                                   PS. This thread is old enough that it no longer appears in Recent Items when someone posts a new comment. I noticed the recent comments strictly by accident. To make sure that a post to a thread that is more than 3 months old gets maximum visibility, start a new thread and include a link to the original in the post you use to open that new thread.

                              • 12. Re: Double Clicking a Button
                                philmodjunk

                                     Ok, no need for a demo file here. Unfortunately for me, a double tap on an iOS device is intercepted by the iOS as a gesture to zoom the display at the point double tapped so I can't come up with something that works on my iPhone. frown

                                     Like Sorbsbuster, I can't get the double tap to be recognized when I set this up on a field. That's because the first tap puts the cursor in the field and pops it to the front of the button object. The next click just repositions the cursor in the field and never succeeds in clicking the button.

                                     I scripted it like this:

                                     Set Variable [$Click ; value: Get ( CurrentTimeStamp ) ]
                                     If [ not IsEmpty ( $$PrevClick ) and ( $Click - $$PrevClick ) < 1 // Double click ]
                                        #Put code to open window for enhanced editing here
                                     Else
                                        Go to Field [Specify the field that was clicked here]
                                     End If

                                     I came up with a work around, but it's pretty clunky.

                                     Set Variable [$Click ; value: Get ( CurrentTimeStamp ) ]
                                     If [ not IsEmpty ( $$PrevClick ) and ( $Click - $$PrevClick ) < 1 // Double click ]
                                        #Put code to open window for enhanced editing here
                                     Else
                                        Install OnTimer Script ["Put Cursor In Field" ; 1 ]
                                     End If

                                     Second script named "Put Cursor In Field":

                                     Go to Field [Specify your field here]
                                     Install OnTimer Script [] ---> this step without parameters cancels the timer so that you don't see the cursor jumping into the field every second.

                                     This works, but there's a 1 second pause before it puts the cursor into the field so that you can edit the text. You may want to use another method such as shift clicking with OnObjectEnter to open the window/go to layout to take the user to your enhanced editor.

                                • 13. Re: Double Clicking a Button
                                  Sorbsbuster

                                       I think a significant part of the problem is that as some 'scientific' people have commented before, Filemaker's 'timer' seems to have a limit of only counting to the second.  I think most people expect a double-click to be much quicker than that.  I set up a variation on Phil's original script and made it do nothing except set two variables as the first and second click timestamp, and with anything that I would consider a 'normal double-click' it simply registered the same time (to the second) for both.

                                  • 14. Re: Double Clicking a Button
                                    ChrisJohnston

                                         Was it successful? Did it go directly to edit (first click) and "do something else (second click)? Could I see a screen shot? Sounds exciting!