Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Tooltips/Balloontips/Annotations
#1
I'm looking for a way to add visual indicators to any software, based on certain mouse location conditions for example:

If my mouse hovers over a menu item in a window, a tooltip popups about the menu item.

I am well-aware this can be done with a general programming language with much pain and suffering, but I'm looking for a way for qm to do it. Other automation software (winautomation, ranorex studio, testcomplete, automate 9, etc...) dont have mouse location event triggers and/or tooltip/balloon tip actions. I have COM controls to take care of the balloontip/tooltip aspect of it, that just leaves me with the mouse location event triggers, any ideas?
#2
For mouse location triggers could be used a mouse hook. Search forum for SetWindowsHookEx WH_MOUSE_LL.

Or use loop like this:

Macro Macro2334
Code:
Copy      Help
POINT p pp
rep
,0.1 ;;calling GetCursorPos and memcmp every 100 ms will not consume too much CPU
,GetCursorPos &p
,if(!memcmp(&p &pp sizeof(p))) continue ;;if mouse not moved
,pp=p
,
,;out "%i %i" p.x p.y
,
,;Now get object from mouse and display tooltip if need.
,;To optimize, use something like above, eg compare current window/object with previous and continue if it is the same.
,
,;example without optimizations
,Acc a.FromMouse; err continue ;;slow! Use PerfFirs/PerfNext/PerfOut to measure speed. To optimize, before compare window/control from mouse (it is faster than Acc functions), unless you need all objects in all windows.
,str s=a.Name; err continue ;;quite slow too. For some objects may need a.Value instead.
,str ps; if(s=ps) continue
,ps=s
,s.trim
,if(!s.len or s="my-tooltip") OsdHide "my-tooltip"; continue
,;out s
,OnScreenDisplay s 0 p.x p.y+20 "" 12 0xff0000 1|4|16 "my-tooltip" 0xc0ffff
,

This should be function, not macro, because runs all the time and then other macros could not run.


Forum Jump:


Users browsing this thread: 1 Guest(s)