W wrote:

>>>I have successfully added a keylistener but I would really like to be
>>>informed by caret movements - even if they are triggered by the mouse.
>>>
>>>Has anyone ever listened to the the CARET_CHANGED event?
>>
>>
>> If you are fine with getting notified for just mouse click and key
>> events inside the document window you can use the
>> com.sun.star.awt.XUserInputInteraction interface that is supported by
>> the Controller objects of each document.
>>
>> If you just want to track if the document cursor is moved around a
>> SelectionChanged listener might be appropriate also.
> 
> What I would really like to do is knowing where the user is currently
> active - that is where the keyboard focus is and where the caret is.
> 
> I guess a selection listener would be ok, if I could add it globally,
> but can you do that?

What means "globally"? A listener always must be registered at an
object, TANSTAAGL ("There is no such things as a global listener" ;-))
if that should mean you can just say "gimme all events".

You always need a source to register for the events. Event sources for
user interactions in the OOo API usually are windows but their current
API only tracks events for each windows separately, you won't get events
for a complete window hierarchy. For this reason we added an API above a
complete window hierarchy inside a document window, the
XUserInputInteraction interface. Each Controller object that controls a
single document window implements this, having a single event source for
all windows seems to be a real mess IMHO.

I still don't understand your goal, the "where" in your sentence

> What I would really like to do is knowing where the user is currently
> active - that is where the keyboard focus is and where the caret is.

is too general and unspecific to me: is it enough to know in which
document window the cursor is and which element inside the window is
selected or at which position the cursor is set? Or are you also
interested to get a notification when the user clicks into scroll bars,
toolbars, dialogs, menues etc.?

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to