Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - TrayIcon MouseDown bug!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TrayIcon MouseDown bug!

 Post Reply Post Reply
Author
Message
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Topic: TrayIcon MouseDown bug!
    Posted: 10 March 2008 at 7:41pm
I am trying to use the MouseDown event on the tray icon to determine when to hide/restore the main window (left button click) vs. when to display a popup menu (right button click).  What I discovered was that in the MouseDown event, every button click shows up as a right button click.

For example, add the following to the suite controls sample application:

Private Sub TrayIcon_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    MsgBox Button
End Sub

The number "2" will pop up for both a right and left mouse click.  A left mouse click should show up as "1". 

The MouseUp event does seem to work correctly but I'm not sure I want to use that event.  A Click event doesn't distinguish between buttons so that won't work for me.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group
Avatar

Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2008 at 6:59am
Thanks, Fixed.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2008 at 10:23am
Hi Oleg,

    Any idea if this:

https://forum.codejock.com/forum_posts.asp?TID=9358

    Will be fixed? (Event sequence for Click, MouseDown, MouseUp out of order)?

Thanks.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group
Avatar

Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2008 at 2:16am
No. These messages comes from OS system tray and we can't change them.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2008 at 9:28am
So this is a bug in the OS? Because all other controls fire MouseDown, MouseUp, Click...but the TrayIcon fires Click, MouseDown, MouseUp. This means that click is firing before the mouse events (i.e. before the TrayIcon has been clicked!). 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group
Avatar

Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2008 at 10:50am
its not bug. There is no official document that describes order of these events. Why you can't just  use MouseUp instead Click ???
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1336
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2008 at 11:10am
It might not officially be a bug, but it is definitely different behaviour from the behaviour of every other ActiveX control I have used. Click always gets fired after the user releases the mouse button, not before MouseDown.

The MSDN documentation for the click event also mentions this:

Visual Basic Reference

Click Event

Occurs when the user presses and then releases a mouse button over an object. It can also occur when the value of a control is changed.


It's not that big a deal, it just wastes time trying to figure out what is wrong when you expect a certain behaviour based on the way just about every other control behaves.



There is also a better reason why this is a problem. On most controls (for example, the PictureBox control) if the user presses the mouse button down while the mouse pointer is over the control and then changes his mind and moves the mouse off of the control and releases the mouse button, only the MouseDown and MouseUp events fire. Therefore, you can place code in the Click event and it will only execute if the user presses and then releases the mouse button while over the control.

With the TrayIcon, you can't put code in the Click event (because it fires before MouseDown) and if you put it in MouseUp you will have to perform additionaly checks to make sure that the mouse button was released while the mouse pointer was actually over the TrayIcon control.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.