Page 1 of 1

Getting a viewcursor in a RichEditControl

Posted: Thu Jan 25, 2018 2:37 am
by taurian
I have a Python app using a non modal window with several controls in Writer 5.4.3.
I can manipulate all controls , enter text, handle keystrokes,
create text cursors, etc.
There is one thing i cannot do: create a view cursor
for a richtextcontrol (RTC). I need a view cursor to be able to parse text
at the current cursor location.

Pressing f12 opens the non modal window and populates the RTC (txt.c)
I position the cursor in the RTC and hit ctl-F12 (there are KeyListeners for all controls) which runs code similar to:

Code: Select all

'''
zt.c		# non modal window control
zt.frame	# non modal window frame (zt,txt are class objects)
txt.m		# rich text model
txt.c		# rich text control
'''
txt.c.setText('wwww')   # 'wwww' is seen in the richtextcontrol
##  i thought this would work:
ctlr		=   zt.frame.getController()
txt.c.setText(repr(ctlr))  ## returns: None in the richtextcontrol
cv  	=   ctlr.getViewCursor()
The value of 'ctlr' is 'None', which is not what I want. I need the controller value of the
non-modal window, not the controller of the Writer document, to get a ViewCursor here.
I have used MRI and
reviewed API Reference & Developers Guide & Basic Guide & have A. Pitonyak's book
all to no avail.
I would appreciate any assistance at all on this.

Re: Getting a viewcursor in a RichEditControl

Posted: Thu Jan 25, 2018 1:35 pm
by Villeroy
Service com.sun.star.form.component.RichTextControl is restricted to database forms. What you are using is a com.sun.star.awt.UnoControlEdit without binding to a database.