Print Page | Close Window

Mouse events for CommandBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=970
Printed Date: 17 November 2024 at 4:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Mouse events for CommandBar
Posted By: IAgree
Subject: Mouse events for CommandBar
Date Posted: 22 July 2004 at 11:46pm
How can I get mouse events for a CommandBars object?

Currently I have a Sheridan toolbar which responds to standard VB events such as MouseUp, MouseDown, MouseMove, etc. and need these events in CodeJock CommandBars. The reason is users can right-click a toolbar icon which displays a popup menu specific for that icon. The popup menu has many options specific to the application I am creating, such as security permissions for the icon.

So, how can I display my own popup menu when a user right clicks on a CodeJock toolbar icon?

Thanks.



Replies:
Posted By: leojay
Date Posted: 28 March 2005 at 8:35pm

I wonder how to handle these mouse events too.

I set the mouse pointer of main form to 9:
Me.MousePointer = 9

and i want to set the mouse pointer back to default pointer when the user moved the mouse out of the main form.



Posted By: Boyd
Date Posted: 28 March 2005 at 9:13pm

The 'ControlSelected' event is fired when you move the mouse over a control, and the 'ControlSelected' event is fired again when you move off the control (with a null value passed for the selected control).

There is no standard way to detect right mouse clicks.  Not sure if there are any hacks to get around it.



Posted By: leojay
Date Posted: 28 March 2005 at 9:57pm

I found a temporary solution to my problem. 

    Dim ptMouse As POINTAPI
    Dim rt As RECT
    rt = GetCommandBarRect
   
    If GetCapture <> Me.hwnd Then
        ptMouse = GetCursor
        If Not (ptMouse.X < rt.Right And ptMouse.X > rt.Left And ptMouse.Y < rt.Bottom And ptMouse.Y > rt.Top) And Me.MousePointer = 9 Then
             Me.MousePointer = 0
        End If
    End If

the GetCursor() and GetCommandBarRect() are my functions to get mouse cursor's position and CommandBar's client area, respectively.

I hope it will be useful to you.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net