Announcement

Collapse
No announcement yet.

about Double click button event

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

  • about Double click button event

    Hello everyone,

    I see a piece of code in the following post, but it can't run, prompt the following error, welcome any suggestions, thank you in advance


    Click image for larger version

Name:	drr.png
Views:	247
Size:	14.2 KB
ID:	305777


    Code:
    ClickTime = DLL.CallFunction(_SystemFolder .. '\\winmm.dll', 'timeGetTime', '', DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
    TimeSpace = ClickTime-TimePrevious
    if TimeSpace<300 then
    --if the time space between two clicks <300 millisecond, then define it as "double-click"then
    --(your action here!)
    Dialog.Message('haha', 'Success!')
    end
    TimePrevious=ClickTime
    -------on page preload,you must define TimeSpace=0

  • #2
    The problem has been solved



    on page preload you must define TimePrevious=0

    Comment


    • #3
      Each button needs to add the above code.

      Is there a more convenient way to double-click

      Comment


      • #4
        try this:
        TimePrevious = 200
        lastClick = 0

        -----------------------
        ClickTime = DLL.CallFunction(_SystemFolder .. '\\winmm.dll', 'timeGetTime', '', DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
        if ClickTime - lastClick < TimePrevious then
        Dialog.Message('haha', 'Success!')
        end
        lastClick = ClickTime

        Comment


        • #5
          Originally posted by telco View Post
          try this:
          TimePrevious = 200
          lastClick = 0

          -----------------------
          ClickTime = DLL.CallFunction(_SystemFolder .. '\\winmm.dll', 'timeGetTime', '', DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
          if ClickTime - lastClick < TimePrevious then
          Dialog.Message('haha', 'Success!')
          end
          lastClick = ClickTime
          thanks telco

          TimePrevious = 300
          The effect is better

          now: My question ,
          All buttons must be inserted into the code above. Can you define the code as a function?
          I've just learned programming, and I don't know much

          Comment


          • #6
            its good also to add function in global so that you will just call the function on your each btn.


            TimePrevious = 200
            lastClick = 0


            function dbl_click()
            ClickTime = DLL.CallFunction(_SystemFolder .. '\\winmm.dll', 'timeGetTime', '', DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
            if ClickTime - lastClick < TimePrevious then
            Dialog.Message('haha', 'Success!')
            end
            lastClick = ClickTime
            end

            Button on click

            dbl_click()

            Comment


            • #7
              add these two lines of code to onpreload for each page ?
              ——————————————————
              TimePrevious = 200
              lastClick = 0

              Comment


              • #8
                you can put it even in the global..

                Comment


                • #9
                  Originally posted by telco View Post
                  you can put it even in the global..
                  function dbl_click()
                  ClickTime = DLL.CallFunction(_SystemFolder .. '\\winmm.dll', 'timeGetTime', '', DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
                  if ClickTime - lastClick < TimePrevious then
                  Dialog.Message('haha', 'Success!') --Delete here?
                  end
                  lastClick = ClickTime
                  end

                  Button on click

                  dbl_click()

                  Comment


                  • #10
                    I don't want message box in the function,

                    dbl_click()
                    Dialog.Message('haha', 'Success!')

                    Comment


                    • #11
                      I am sorry my friend, but YOU should really start READING the manual before asking for help and saying I am only a BEGINNER!!!!!!!!

                      Comments
                      You can insert non-executable comments into your scripts to explain and document your code. In a script, any text after two dashes (--) on a line will be ignored. For example:

                      if ClickTime - lastClick < TimePrevious then
                      --Dialog.Message('haha', 'Success!') --Delete here?
                      end

                      Comment


                      • #12
                        Originally posted by colc View Post
                        I am sorry my friend, but YOU should really start READING the manual before asking for help and saying I am only a BEGINNER!!!!!!!!

                        Comments
                        You can insert non-executable comments into your scripts to explain and document your code. In a script, any text after two dashes (--) on a line will be ignored. For example:

                        if ClickTime - lastClick < TimePrevious then
                        --Dialog.Message('haha', 'Success!') --Delete here?
                        end
                        Thank you for your reminder,
                        I've read the help section on functions, but I don't quite understand the example above
                        --Dialog.Message('haha', 'Success!')
                        Cannot run after comment

                        Comment


                        • #13
                          kevin8
                          WTF don't you understand
                          Code:
                          [B]You can insert [SIZE=20px][COLOR=#c0392b]non-executable[/COLOR][/SIZE] comments into your scripts[/B]
                          Nothing will happen after
                          Code:
                          if ClickTime - lastClick < TimePrevious then
                          AS YOU have COMMENTED it out so no script will run therefore the message box will not appear, if you insert some other code after the "IF Statement" then something will happen unless you again comment it out with "--" double dashes

                          BY inserting -- into your script at the start of a line it will NOT EXECUTE and go to the next line which is an "end" of the if statement, then set Variables lastClick = ClickTime then end function

                          DO you understand??

                          Comment


                          • #14
                            colc just relax hahaha..

                            Comment

                            Working...
                            X