Announcement

Collapse
No announcement yet.

Detect doubleclick on button

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Detect doubleclick on button

    I'd like to be able to process both the click and the double click on a normal button using DDT and Forms. This is simple enough that I can do it fine without Forms and I wouldn't really mind using something to substitute for the button if needed.

    I realize this can be done with SDK programming but if I can I'd like to put off getting into that just a little longer. If I can.

    Any easy way to do this? Why isn't stuff this basic included in either DDT or Forms? Is it likely to be next update?

    Thanks for any suggestions.

    Barry

  • #2
    You must use the %BS_NOTIFY style with the Button when creating it.

    This will generate the %BN_DBLCLK notification event (sent to your button DDT control callback function).
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      I believe there is a class style for the form and/or button to even send double click messages too. I usually turn it off on mine when I use FireFly because people have a habit of double clicking buttons and I try to get them to stop. I used to process both as the same in one message handler, but it got old having to put both. I'm not sure what the default in DDT is, but you should be able to set it.

      Added: Looks like it is the class of the form- CS_DBLCLKS
      sigpic
      Mobile Solutions
      Sys Analyst and Development

      Comment


      • #4
        Roger,

        Be careful in referencing something from FireFly, since it may not be what you think. FireFly has a good deal of library code which may do all sorts of tricks for you. You are probably dealing with a custom window class for the parent Form which is probably what the CS_DBLCLKS class style is for, but this will have no effect on the controls, but only the form and has little meaning for a DDT app.

        For DDT apps, the BS_NOTIFY style is exactly what is needed and this generates the BN_DBLCLK notification event (passed through WM_COMMAND) which will be sent to the DDT control callback function.

        DDT apps can't define the form (dialog) class style, since the class is a predefined class in Windows and not a user defined class.
        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment


        • #5
          Won't that be kind of an awkard user interface? Buttons are clicked, something happens. You don't double-click buttons.

          ??
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Personally I hate double clicks. Often users move between clicks and drag something. I like an interface with single clicks and right clicks only. And only icons and entries in a list should be doubld clicked if anything. Never buttons. I think Calc in Windows even blocks double clicks of buttons just to prevent mistakes.
            sigpic
            Mobile Solutions
            Sys Analyst and Development

            Comment


            • #7
              I like double clicks of sorts...the first means I meant to pick it...not just highlight it...the second means I MEANNNNNT to click it

              To me though...if a button, that breaks the rule...obviously if I clicked it, I did it on purpose and meant to click it
              Engineer's Motto: If it aint broke take it apart and fix it

              "If at 1st you don't succeed... call it version 1.0"

              "Half of Programming is coding"....."The other 90% is DEBUGGING"

              "Document my code????" .... "WHYYY??? do you think they call it CODE? "

              Comment


              • #8
                Thanks for the %BS_NOTIFY tip. It sounds like what I'm looking for.

                As for liking or not liking double clicks, I guess I fall somewhat on the side of not liking them. However, they do exist.

                I live in a rural retirement home where most of the residents, many in their 80's, have never been around computers, and they just provided one for everyone to use. I'm trying to help some of them get started with email, etc. and they're having a lot of problems with double-clicks.

                I want to make up a little program for them to practice on so double-clicks are sort of the point.

                Again, thanks for the tip. I'll give that a try

                Barry

                Comment


                • #9
                  I tried using %BS_NOTIFY but it doesn't get the %BN_DBLCLK message. I tried it as a message within %WM_COMMAND and also as a seperate message within the button notification and it doesn't seem to get either.

                  Here's the code showing both:

                  CASE %WM_COMMAND
                  ' Process control notifications
                  SELECT CASE AS LONG CBCTL
                  CASE %LBL_LABEL1

                  CASE %BN_DBLCLK
                  MSGBOX "Double clicked=" + FORMAT$(%BTN_CLICKME), _
                  %MB_TASKMODAL

                  CASE %BTN_CLICKME
                  IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN
                  MSGBOX "%BTN_CLICKME=" + FORMAT$(CBCTLMSG), _
                  %MB_TASKMODAL
                  END IF
                  IF CBCTLMSG = %BN_DBLCLK THEN
                  MSGBOX "Double clicked=", _
                  %MB_TASKMODAL
                  END IF

                  END SELECT
                  Any ideas?

                  Barry

                  Comment


                  • #10
                    Purely from memory (ie may be way off base)...

                    Double-click message always results first in a single-click message. If second click does not occur 'quickly enough' (there's a system parameter you can reset if desired) then 'double click' does not occur.

                    No way are you dismissing that MSGBOX on click quickly enough to allow double-click to occur.

                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Yep! That was it. It's working fine now.

                      Thanks,
                      Barry

                      Comment


                      • #12
                        So one (1) click on a button does....nothing?

                        Gee, I can't wait to learn how to use THAT software.....
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Originally posted by Michael Mattias View Post
                          So one (1) click on a button does....nothing?

                          Gee, I can't wait to learn how to use THAT software.....
                          Not at all! If they single click the button it says "Single Click". If they double click it it says "Double Click" and the background of the text flashes red. It's really exciting.

                          However, the intended users seemed to share your opinion. They opted to learn to play Solitaire instead of practicing clicks and double clicks.

                          Oh well.

                          Barry

                          Comment


                          • #14
                            [Users] opted to learn to play Solitaire instead of practicing clicks and double clicks.
                            Good for them!

                            You know what you could use is a listview control in icon or large-icon mode. Then they can click on an icon to select it, or double-click to select and "DO".. and they can rearrange the buttons (icons) all they want, just the way they want them!

                            Of course, you'll have to find some icons....but it might be a kind of nice thing for users..

                            MCM
                            Michael Mattias
                            Tal Systems (retired)
                            Port Washington WI USA
                            [email protected]
                            http://www.talsystems.com

                            Comment


                            • #15
                              The object is to get them interested in using the computer. Most of these people are in their 70s and 80s and have never used one before. I'm 67 and I'm one of the youngest ones here.

                              Anyway, Solitare seems to be doing that. Most of them know and like Solitaire and several have started playing every day. A couple are even shopping for cheap computers so they can play in their apartments.

                              Anyway, I think I'll just let things stand as they are. Everything I've tried to do to interest them has been ignored and hasn't really been needed anyway.

                              We're getting broadband, too, but it might be another couple weeks. I'm hoping there'll be a lot of interest in email. Most of these people have families that have computers that they can communicate with when that's available.

                              Everyone's initial reaction was that they didn't want to get near the thing but several have been won over by Solitare. We still have one resident who insists that computers are wicked and we're all risking our souls.

                              Barry

                              Comment


                              • #16
                                Turn them on to FreeCell - with the 'Double click moves card to free cell' option enabled they'll get to practice double clicks as well as click & drag.
                                Rgds, Dave

                                Comment


                                • #17
                                  Originally posted by Dave Biggs View Post
                                  Turn them on to FreeCell - with the 'Double click moves card to free cell' option enabled they'll get to practice double clicks as well as click & drag.

                                  Great idea, Dave. Just started back with FreeCell a few weeks ago. I used to play it a lot. My personal record is 74 wins in a row. I used a system. Whenever I lost a game, I would replay the same one until I beat it (sometimes playing the same one over and over, maybe 10-20 times. Only found one or two unbeatable).

                                  Whenever I got on a streak of 10 wins, from there on I would only play 3 games at a sitting. Seems like the mind got tired or distracted after 3 in a row.

                                  Another really great "think ahead" game is "Genius Move". Only one I like better than FreeCell. Not a freebie though. I think it was around $20.

                                  ======================================
                                  A lie stands on one leg, truth on two.
                                  Ben Franklin
                                  ======================================
                                  It's a pretty day. I hope you enjoy it.

                                  Gösta

                                  JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                  LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                  Comment


                                  • #18
                                    Its like my Grandmother, always afraid she will break the danged thing *LOL*

                                    Try Cribbage too if any of them are from the New England areas (very addictive and fun to play)


                                    For the most part though....I would leave the internet out of it because that is opening Pandora's box in most cases.
                                    Engineer's Motto: If it aint broke take it apart and fix it

                                    "If at 1st you don't succeed... call it version 1.0"

                                    "Half of Programming is coding"....."The other 90% is DEBUGGING"

                                    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                                    Comment

                                    Working...
                                    X