Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 06 APR 2005 11:19:01PM David Goddard wrote:

I'd like to do the following:

Display a menu under a push button when the user clicks on the button. Internet Explorer does this on the Back and Forward buttons. EG clicking the down arrow next to back button displays a menu located under the back button with a list of the last 10 pages viewed.

I can create context menus Ok, but the user needs to rightclick to display the menu and the menu appears where the user clicked.

So how do you display a menu at a specified location when a push button is clicked?

Thanks

Dave G


At 07 APR 2005 12:09AM [email protected]'s Don Bakke wrote:

David,

I haven't tried this myself but I don't see why you can't use a different context menu for the same button to do the same thing. But you'll use the CLICK event to create a different menu structure, modify the lParam to position the menu underneath the button, and then use the PostMessage call to call the popup menu.

[email protected]

SRP Computer Solutions, Inc.


At 07 APR 2005 12:15AM David Goddard wrote:

Thanks Don,

I'll give it a go and let you know how I get on.

Dave G


At 07 APR 2005 01:03AM David Goddard wrote:

PostMessage was the trick! Now I have a context menu appearing when the user clicks the push button. Still playing with positioning but hey, i'm half way there.

Thanks

Dave G


At 07 APR 2005 01:17AM [email protected]'s Don Bakke wrote:

At 07 APR 2005 01:53AM David Goddard wrote:

Still having a problem with the position.

I'm calling postmessage as follows

PostMessage(handle,516,0,clickposition)

516 is the Rbuttondown event

0 - does not seem to do anything

clickpos - you specify the position of the mouse here. I can change the Y position OK but the x position does not want to move.

PostMessage uses the top left corner of my button as a starting position. I can pass a negative number to move the mouseclick left, but I can not move the mouseclick down below my push button. So the context menu will appear over my button, not under it.

on MSDN is says that the low-order word specifies the x-coordinate of the cursor and the high-order word specifies the y-coordinate of the cursor. Not sure exactly what this means?

Any help greatly appreciated.

Dave G


At 07 APR 2005 04:22AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Dave,

on MSDN is says that the low-order word specifies the x-coordinate of the cursor and the high-order word specifies the y-coordinate of the cursor. Not sure exactly what this means?

It means that the number that you pass in lParam (which the engine translates into a 32-bit integer for you) is actually composed of two 16-bit values, so you need to pack your x and y into this structure accordingly.

eg:

loWord=45

hiWord=30

longVal=( hiWord * 65535 ) + loWord

The Sprezzatura Group

World leaders in all things RevSoft


At 07 APR 2005 06:11PM David Goddard wrote:

Thanks, works like a bought one now!

Dave G

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/6cc758526636ed5d85256fdc001238ac.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1