OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to place the View-Cursor in a writer Doc?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Toxitom
General User
General User


Joined: 13 Jan 2004
Posts: 9
Location: Wiesbaden, Germany

PostPosted: Tue Dec 06, 2005 8:27 am    Post subject: How to place the View-Cursor in a writer Doc? Reply with quote

Hey everyone,

I do have a specific task and need some help:

There is a form inside a writer Document. User will get from field to field via Tab-button. When reaching the last field, a macro should start (ok, no problem) and place the View-Cursor to a specifiic position inside the writer document.

Well, it is possible to place a cursor and mark some text (for examble), nevertheless the ViewCursor stay inside of the form and move to the next field (in this way to the first field).

I belief, there is some work to do with the currentController, but I do not get any results.
Any Ideas?

It will help me, if someone knows how to leave a form and place the Viewcursor inside the writer doc.

Thanks
Thomas
Back to top
View user's profile Send private message Visit poster's website
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Tue Dec 06, 2005 11:57 am    Post subject: Reply with quote

Quote:
nevertheless the ViewCursor stay inside of the form and move to the next field

How do you move the view cursor? Warning, I have not tested any of the following code in any way...
Code:
oViewCursor = ThisComponent.getCurrentController().getViewCursor()
oCursor = ThisComponent.getText().createTextCursor()
oCursor.gotoEnd(False)
oViewCursor.gotoRange(oCursor, False)

If you know that you want to select something else, you can also try something like:
Code:
ThisComponent.getCurrentController().select(oCursor)

_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Toxitom
General User
General User


Joined: 13 Jan 2004
Posts: 9
Location: Wiesbaden, Germany

PostPosted: Wed Dec 07, 2005 12:18 am    Post subject: Reply with quote

Hey Andrew,

thanks for your repley, but this did not solve the problem.

I can select everything inside the Writer-Document, you will even see the selection, nevertheless the ViewCursor (this small blinking thing) stay inside of the form - in the next field.

So in my opinion, the form placed on the drawpage still "craps" the focus and is still aktiv. I do not have any ideas to leave the form via makro.

When I analyse the dokument, there seemed to be two Viewcursor - one inside the form, one inside of the text (document). Using the mouse and leavinf the form, the viecursor is still at the last position inside the text - so this is anywhere stored. This position I can change via macro, no problem, even when calling the macro from inside the form.
But - what i try to do is to move the focus from inside the form to outside - so back to the text-document. Any Ideas herefor?

Best regards
Thomas
_________________
OpenOffice.org Deutschland e.V.
Bücher: OpenOffice.org 2.0 - Einstieg und Umstieg
Makros für OOo 2.0
Back to top
View user's profile Send private message Visit poster's website
Toxitom
General User
General User


Joined: 13 Jan 2004
Posts: 9
Location: Wiesbaden, Germany

PostPosted: Wed Dec 07, 2005 2:52 am    Post subject: solved! Reply with quote

Hey all,

ok, I have found a way to aktivat the viewcursor inside the text-part and leave the form:

Code:
...
   oWin = StarDesktop.getCurrentFrame().getContainerWindow()
   oWin.setFocus()
...

these simple lines give the control back - now I can select everything I want and can place my viewcursor.

Thanks
Thomas
_________________
OpenOffice.org Deutschland e.V.
Bücher: OpenOffice.org 2.0 - Einstieg und Umstieg
Makros für OOo 2.0
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group