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
Solved! Go to Solution.
Solved by StepanK. Go to Solution.
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.