|
|||
|
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 |
|
|
||||
|
||||
|
|
|
|||
|
"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". |
|
|||
|
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. |
|
|||
|
Thank You
All Sorted Now, Found The Answer here: http://www.xtremevbtalk.com/archive/...p/t-43911.html |
|
|||
|
"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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
"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 |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|