MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

context popup menu above a button?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
StepanK
706 Views, 2 Replies

context popup menu above a button?

Hi,

 

I'd like to display a simple context menu (the one usually displayed with right mouse click, drawn with FBGenericMenu) under a mouse cursor when I click a button in my toolbox.

My problem is FBGenericMenu.Execute(x,y) used to draw the popup needs absolute x,y mouse coordinates and I'd want to display it above a FBButton, activated with a mouse click. I worry FBEventActivate returned by the button after the mouse click doesn't contain mouse coordinates.

Any idea, how to get absolute mouse coordinates or coordinates of the UI element (button)?

Thanks so much,

Stepan

2 REPLIES 2
Message 2 of 3
s
Advocate
in reply to: StepanK

Hi,

in OR SDK I do it like that - https://gist.github.com/Neill3d/10538444
I'm using win32 API function to get absolute mouse coords.

---
Best regards, Neill3d
---
Programming and Animation - neill3d.com
Message 3 of 3
StepanK
in reply to: StepanK

Autodesk engineers were very helpful, sharing the solution their support team provided (many thanks to them!):

 

from pyfbsdk import *
from ctypes import windll, pointer, c_long, c_ulong, Structure

class _point_t(Structure):
    _fields_ = [('x', c_long),('y', c_long),]
point = _point_t()
result = windll.user32.GetCursorPos(pointer(point))
if result:
    print point.x, point.y


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report