Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get Caret Position if a toolbar button is clicked
#1
My question is :
Is there a way to memorise the last caret position on a window, before clicking a toolbar's button?


More specifically the problem is as it follows :

I need to run a macro by clicking on a toolbar, that needs the caret position just before the macro initiation.

If the window is a notepad like client window you can get it through a SendMessage- EM_GETSEL statement. I try to find a solution in the case of a OE client window (Internet Explorer_Server class window).

I understand that you can by-pass this issue if - instead of using a toobar - you use a right click menu item.

Any advice is mostly welcome.
#2
Sorry for any disturbance, it was my mistake : the toolbar was associated to a wrong control.
#3
If need caret coordinates, function GetCaretXY.
If need character position like EM_GETSEL in Edit and rich edit controls, try this:
Macro Macro2529
Trigger F8     Help - how to add the trigger to the macro
Code:
Copy      Help
spe 10
key CSH
str s.getsel
if(s.len) key R ;;restore caret position; this works differently in different windows
out s.len
#4
Many thanks, indeed.


Forum Jump:


Users browsing this thread: 1 Guest(s)