Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cursor Location
#5
Function IsEditableTextControlFocused
Code:
Copy      Help
;/
function# [&caretX] [&caretY] [&caretW] [&caretH] [Acc&aFocus]

;If caret is in an editable text field, returns handle of the control.
;Else returns 0.
;This function works not with all windows/controls.

;caretX ... - optional variables that receive caret location and focused accessible object.


int x y cx cy
int w=GetCaretXY(x y cx cy)
if(!w) ret

Acc a=acc
if(!a.a or a.State&STATE_SYSTEM_READONLY) ret

if(&caretX) caretX=x
if(&caretY) caretY=y
if(&caretW) caretW=cx
if(&caretH) caretH=cy
if(&aFocus) aFocus=a

ret w

test
Macro Macro1500
Trigger F12     Help - how to add the trigger to the macro
Code:
Copy      Help
out
int w1 x y cx cy; Acc a
w1=IsEditableTextControlFocused(x y cx cy a)
if(!w1) ret
out "%i %i %i %i" x y cx cy
outw w1
a.Role(_s); out _s
a.State(_s); out _s
out a.Name
out a.Value

Tested with simple edit/richedit controls, IE, Firefox and Word 2003.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)