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

Cursor problem

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Angellina
OOo Enthusiast
OOo Enthusiast


Joined: 28 May 2004
Posts: 130
Location: France - Paris

PostPosted: Sat May 29, 2004 1:17 pm    Post subject: Cursor problem Reply with quote

Hello,
I want to insert a text and make the cursor at the line after, can you help me please?
Angellina
Back to top
View user's profile Send private message
ftack
Moderator
Moderator


Joined: 27 Jan 2003
Posts: 3102
Location: Belgium

PostPosted: Sun May 30, 2004 2:34 am    Post subject: Reply with quote

Why don't you press "Enter" after insterting the text? In other words, can you be more clear and specific about your problem, because I didn't get it?
Back to top
View user's profile Send private message
Angellina
OOo Enthusiast
OOo Enthusiast


Joined: 28 May 2004
Posts: 130
Location: France - Paris

PostPosted: Mon May 31, 2004 3:21 am    Post subject: Reply with quote

I'm programming with OOBasic and I want to do a sub which permet to the user to insert a text and to have the cursor at the line after
Back to top
View user's profile Send private message
David
Super User
Super User


Joined: 24 Oct 2003
Posts: 5668
Location: Canada

PostPosted: Mon May 31, 2004 5:11 am    Post subject: Reply with quote

Angellina wrote:
I'm programming with OOBasic and I want to do a sub which permet to the user to insert a text and to have the cursor at the line after


I haven't programmed in that language [and would appreciate a pointer myself on where to start], but in any other language I've met, a simple "PRINT" statement usually does that automatically. There must be an equivalent in OOBasic.

David.
Back to top
View user's profile Send private message
Guest






PostPosted: Mon May 31, 2004 12:48 pm    Post subject: Reply with quote

Angelina,

maybe this little example will set you in the right direction ??

Sub Main
Dim MyDocument As Object, MyText As Object
Dim MyCursor As Object
Dim ParaEnd As Integer

MyDocument = ThisComponent
MyText = MyDocument.Text
ParaEnd = com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK
MyCursor= MyText.createTextCursor

MyText.insertString( MyCursor, "Start of text (first line)", false)
MyText.insertControlCharacter( MyCursor, ParaEnd , false)
MyText.insertString( MyCursor, "Second line", false)
MyText.insertControlCharacter( MyCursor, ParaEnd , false)
MyText.insertString( MyCursor, "Begin paragraph 3 ", false)
MyText.insertControlCharacter( MyCursor, ParaEnd , false)
MyText.insertControlCharacter( MyCursor, ParaEnd , false)
MyText.insertString( MyCursor, "Two paragraph breaks added ", false)

MyCursor.paraStyleName= "Standard"
MyCursor.CharColor = 225
MyCursor.CharShadowed = true
MyText.insertString( MyCursor, " added in colour", false)

End Sub

Good luck
DiGro
Back to top
Guest






PostPosted: Tue Jun 01, 2004 3:47 am    Post subject: Reply with quote

thank you very mutch DiGro, your sub run successfuly
I've just changed the instruction "MyCursor= MyText.createTextCursor" to
"Mycursor= MyText.currentcontroller.getviewcursor()" because TextCursor cannot be viewed by the user but viewcursor is the cursor we can view
Thank you
Back to top
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Jun 01, 2004 5:39 am    Post subject: Reply with quote

See this...

Writer Examples
http://www.oooforum.org/forum/viewtopic.php?t=6049

for many example code that includes the following techniques....
1. create / open writer documents
2. save writer documents
3. print writer documents
4. insert and manipulate text in writer documents
5. change styles of paragraphs
6. get cursors and navigate them throughout the document
7. manipulate the visible cursor that the user sees on the screen

See this that I just posted....
http://www.oooforum.org/forum/viewtopic.php?p=35062#35062
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
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