dcsimg
Results 1 to 12 of 12

Thread: Disable DoubleClick?

  1. #1

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Question Disable DoubleClick?

    Hey,

    is there any way to disable an objects DoubleClick Event?.. ive created a commandbutton in picturebox, and the mousedown event draws when the user presses the button, then the mouseup releases that, but sometimes this event STOLES the handle from the mousedown/up and i cant modify the commandbuttons face, so i think my only way to do this, to disable this dbclick event... well, but how?!

    any ideas?

    thx,
    Jim.

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Confused...

    If there is no code in the Double-Click event, then nothing should happen, so I'm somewhat confused by the question.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Confused...

    Originally posted by Hack
    If there is no code in the Double-Click event, then nothing should happen, so I'm somewhat confused by the question.


    well.. every time when im' clickin on the button, the mousedown event accept only the 2nd click. why? bcause the time between the 2 clicks is too short for the mouse events?
    nope.. the double click event stole the handle from them.. anyway theres NOTHING in the dbclick event...

    so.. if i cant turn off the dblclick check, then is there any other way to accept a mouse click?

    ummm.. first of all i'll try the HEX(x) in the mousemove...

    brb

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335
    I've run into a similiar situation. I think I understand now.

    It sounds like another control on your forum is not releasing its focus. The first click gives focus to your button, and the second executes whatever code you have making it seem as through you need to double click.

    What control has focus before you click on the button? What is it doing?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    nononoo. :X

    well.. ive meand the 2nd click is at the same time, so, im pressing the button like the mad and then the button mousedown event cannot get the all of my clicks only the 2nd, 4th, 6th.. right?

    ive some trouble with english, but i hope its clear for you now

    It sounds like another control on your forum is not releasing its focus.
    have you tried to use the mousemove event to catch the focus for that object?
    Sub Object_MouseMove(..)
    Object.SetFocus

    i know its not very nice, but useful

  6. #6

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    broaf

  7. #7
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262

    MouseDown

    What type of code do you have in your mousedown event?

    What type of command button are you using? If you are using a third party button which was developed with MFC, you could run into problems on the mousedown event.

    Would it be possible to see the code in for the button?

    Jerel

  8. #8

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    i think theres nothing to see, because the mousedown event just calls a sub where i'm draws the picture of a pressed button.

    What type of command button are you using? If you are using a third party button which was developed with MFC, you could run into problems on the mousedown event.
    first of all, pls explain me whats MFC :> anyway this button is mine, it runs in a class.

    well.. okay, heres it, but i think you cant figure out my problem without disabling the doubleclick preview... or if is there any other object, i can draw lines and text, and theres no doubleclick event, then share with me pls, because i havent found :|

    anyway as you can see, the vb's commandbuttons havent doubleclick preview, just the click, and the mousedown/up events...

    Jim
    Last edited by Jim Davis; Jun 12th, 2002 at 09:15 AM.

  9. #9
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262

    Button Progam

    Jim,

    I want to try and better understand where you are going with this project.

    As for your first question. MFC stands for Microsoft Foundation Classes and they are used for creating various things in windows. They are for use in C++ only for right now.

    My first question is: Do you have to have the button as a class? What I mean is I think the project would better be suited as an ActiveX control rather than a pure class object.

    The major thing I see is you have the button_resize event firing 4-5 times every event depening on whether you click fast enough for the double click event to fire. Any time you use a command button, you have to decide which events you are going to use. The mousedown and click are going to fire everytime the button is pushed. There is no going around this unless you make a new button that functions different. The fact that you have code in your class for the click means its going to fire and the drawbutton sub will run.

    Here is the sequence I see:

    Button_MouseDown in Class fires
    calls Drawbutton
    Mousedown on form fires
    calls button_resize
    calls drawbutton
    Button_Click fires
    calls Drawbutton

    This happens with every single click of the mouse button. When you are pressing the button fast like you mentioned, you are also causing the dblclick event to fire in there as well. I think this is the delay you are seeing.

    I also noticed the mousemove event, this event is redrawing the button when the mouse is over it. Do you need the program to continuously redraw the button as a user moves the mouse over your form?

    I hoe this helps. I will be more than happy to help you with anything you need. I see where you are going with the control and think it would best be served as an ActiveX control rather than a pure class object.

    Jerel

  10. #10

    Thread Starter
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284
    well..
    button_resize is called only when the picturebox resized, and once first time in the init procedure (only once!) so, theres no frequently recall of that sub..

    doubleclick.. yes, this thread exactly about that, i see and i know ive fired this event, but im never wanted! i'm want to use only the mousedown event, but when ive a double click, that will stoles the handle from the mouse down event, and i cant display a pressed button without this event...

    I also noticed the mousemove event, this event is redrawing the button when the mouse is over it. Do you need the program to continuously redraw the button as a user moves the mouse over your form?
    yes, as you can see the code isnt complete yet. its needed to redraw only if the button was pressed previously .. i'll fix that, but not that my problem yet

    anyway, as you can see too, the drawbutton is a complete handle of the drawing, if you send a 0 code to this sub, then it will just display a normal-state button, if you send 1 it will draws a pressed button, or 2 then draws a disabled button.. or if you send the code 255, it just redraws the last known state (usefull when you changes the buttons caption only!)

    Jim.

  11. #11
    New Member Paulo32's Avatar
    Join Date
    Oct 2018
    Posts
    1

    Re: Disable DoubleClick?

    Try this to fire the Click event in the DblClick sub:

    Private Sub UserControl_DblClick()
    RaiseEvent Click
    End Sub

  12. #12
    Hyperactive Member
    Join Date
    Feb 2019
    Posts
    382

    Re: Disable DoubleClick?

    You are responding to a 17 years old thread, I hope the OP solved the problem by now, or googled how to remove CS_DBLCLKS style.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width