| View previous topic :: View next topic |
| Author |
Message |
Angellina OOo Enthusiast

Joined: 28 May 2004 Posts: 130 Location: France - Paris
|
Posted: Sat May 29, 2004 1:17 pm Post subject: Cursor problem |
|
|
Hello,
I want to insert a text and make the cursor at the line after, can you help me please?
Angellina |
|
| Back to top |
|
 |
ftack Moderator


Joined: 27 Jan 2003 Posts: 3102 Location: Belgium
|
Posted: Sun May 30, 2004 2:34 am Post subject: |
|
|
| 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 |
|
 |
Angellina OOo Enthusiast

Joined: 28 May 2004 Posts: 130 Location: France - Paris
|
Posted: Mon May 31, 2004 3:21 am Post subject: |
|
|
| 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 |
|
 |
David Super User


Joined: 24 Oct 2003 Posts: 5668 Location: Canada
|
Posted: Mon May 31, 2004 5:11 am Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Mon May 31, 2004 12:48 pm Post subject: |
|
|
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
|
Posted: Tue Jun 01, 2004 3:47 am Post subject: |
|
|
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


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
|