Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.basic.misc > Newsgroup comp.lang.basic.visual.misc

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2012, 10:58 PM
Ivar
Guest
 
Posts: n/a
Default Fast Click

Hi All.

I asked this question a fair few years ago and got a really good answer, but
now totally forgotten it. So here it is again.
VB6
Got a PictureBox, The only even is the Click event.
There is some way that the click event of the picturebox can be set so that
it responds to each click event no matter how short the interval between
events is.
If I remember right it's get something to do with clsID
Can anyone help?

Thanks

Ivar

Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 02-07-2012, 11:07 PM
Farnsworth
Guest
 
Posts: n/a
Default Re: Fast Click

"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message
news:VUiYq.75827$Mc2.31602@newsfe30.ams2...
> Hi All.
>
> I asked this question a fair few years ago and got a really good answer,
> but now totally forgotten it. So here it is again.
> VB6
> Got a PictureBox, The only even is the Click event.
> There is some way that the click event of the picturebox can be set so
> that it responds to each click event no matter how short the interval
> between events is.
> If I remember right it's get something to do with clsID
> Can anyone help?


You need to remove the double click style so Windows doesn't wait for the
double-click time. Search the newsgroups for "vb SetClassLong CS_DBLCLKS".


Reply With Quote
  #3 (permalink)  
Old 02-08-2012, 01:25 AM
Auric__
Guest
 
Posts: n/a
Default Re: Fast Click

Farnsworth wrote:

> "Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message
> news:VUiYq.75827$Mc2.31602@newsfe30.ams2...
>> Hi All.
>>
>> I asked this question a fair few years ago and got a really good answer,
>> but now totally forgotten it. So here it is again.
>> VB6
>> Got a PictureBox, The only even is the Click event.
>> There is some way that the click event of the picturebox can be set so
>> that it responds to each click event no matter how short the interval
>> between events is.
>> If I remember right it's get something to do with clsID
>> Can anyone help?

>
> You need to remove the double click style so Windows doesn't wait for the
> double-click time. Search the newsgroups for "vb SetClassLong CS_DBLCLKS".


The one place I had to worry about this, I simply added a DblClick event that
called the Click event twice. Overly-simplistic perhaps, but it worked... I
think.

--
They are way too perky to be here.
Reply With Quote
  #4 (permalink)  
Old 02-08-2012, 07:23 AM
Ivar
Guest
 
Posts: n/a
Default Re: Fast Click

Thank You

All Sorted Now, Found The Answer here:

http://www.xtremevbtalk.com/archive/...p/t-43911.html
Reply With Quote
  #5 (permalink)  
Old 02-08-2012, 08:33 AM
Mike Williams
Guest
 
Posts: n/a
Default Re: Fast Click

"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message
news:VUiYq.75827$Mc2.31602@newsfe30.ams2...
> Got a PictureBox, The only even is the Click event.
> There is some way that the click event of the picturebox
> can be set so that it responds to each click event no matter
> how short the interval between events is. If I remember
> right it's get something to do with clsID
> Can anyone help?


As Farnsworth has already said, you can use SetClassLong with the
CS_DBLCLICKS flag. Here is an example (declarations omitted):

Dim oldStyle As Long
oldStyle = GetClassLong(Picture1.hWnd, GCL_STYLE)
SetClassLong Picture1.hWnd, GCL_STYLE, _
oldStyle And Not CS_DBLCLKS

You need to bear in mind that doing so will remove the double clicks not
only from Picture1 but also from all PictureBoxes in all Forms in your
project. If this is not what you want then you will need to return the
double click action back to normal when the user is interacting with other
PictureBoxes in your project. You can do this using code similar to the
above but using 'oldStyle Or CS_DBLCLKS' rather than 'oldStyle And Not
CS_DBLCLKS'. You also need to ensure that you use similar code turn the
effect off in your main Form's Unload event, otherwise when testing programs
in the VB IDE you will find that the effect carries over from one run to the
next, which may be a little confusing.

A much simpler alternative of course would be to forget all about the above
code and simply use the PictureBox's MouseUp event instead of its Click
event, which will probably suit your needs.

Mike


Reply With Quote
  #6 (permalink)  
Old 02-08-2012, 10:58 AM
Ivar
Guest
 
Posts: n/a
Default Re: Fast Click


Hi Mike.

I did a test, you are right, it affects all picture boxes. Not that any
other picbox uses the double click event but knowing that now will avoid
confusion in the future.

Use the mouse Down and up events. How simple is that!
I think I need to get out for a while :-)
Thanks for the waffle mike, keep it up

Ivar


"Mike Williams" wrote in message news:jgtfhd$5cq$1@dont-email.me...
As Farnsworth has already said, you can use SetClassLong with the
CS_DBLCLICKS flag. Here is an example (declarations omitted):

Dim oldStyle As Long
oldStyle = GetClassLong(Picture1.hWnd, GCL_STYLE)
SetClassLong Picture1.hWnd, GCL_STYLE, _
oldStyle And Not CS_DBLCLKS

You need to bear in mind that doing so will remove the double clicks not
only from Picture1 but also from all PictureBoxes in all Forms in your
project. If this is not what you want then you will need to return the
double click action back to normal when the user is interacting with other
PictureBoxes in your project. You can do this using code similar to the
above but using 'oldStyle Or CS_DBLCLKS' rather than 'oldStyle And Not
CS_DBLCLKS'. You also need to ensure that you use similar code turn the
effect off in your main Form's Unload event, otherwise when testing programs
in the VB IDE you will find that the effect carries over from one run to the
next, which may be a little confusing.

A much simpler alternative of course would be to forget all about the above
code and simply use the PictureBox's MouseUp event instead of its Click
event, which will probably suit your needs.

Mike


Reply With Quote
  #7 (permalink)  
Old 02-08-2012, 04:28 PM
Ivar
Guest
 
Posts: n/a
Default Re: Fast Click

Further to last posting

Went out for a while, came back and tested the mouse down up events. They
now respond in the same way as the click event with the same delay in
responding to events when rapid clicking.
VB must have been reset after I shut it down.
Back to the first way I suppose.

Ivar

Reply With Quote
  #8 (permalink)  
Old 02-08-2012, 04:28 PM
Ivar
Guest
 
Posts: n/a
Default Re: Fast Click

Further to last posting

Went out for a while, came back and tested the mouse down up events. They
now respond in the same way as the click event with the same delay in
responding to events when rapid clicking.
VB must have been reset after I shut it down.
Back to the first way I suppose.

Ivar

Reply With Quote
  #9 (permalink)  
Old 02-08-2012, 05:29 PM
Mike Williams
Guest
 
Posts: n/a
Default Re: Fast Click

"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message
news:KgyYq.83536$cl.33968@newsfe21.ams2...
> Further to last posting Went out for a while, came back and tested the
> mouse down
> up events. They now respond in the same way as the click
> event with the same delay in responding to events when rapid
> clicking. VB must have been reset after I shut it down.
> Back to the first way I suppose.


I never suggested MouseDown, Ivar . . . I suggested MouseUp. If you click
the mouse a dozen times in the PictureBox then you will get a dozen MouseUp
events regardless of how fast you click.

Mike




Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 04:56 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.