Home » U++ Library support » RichText,QTF,RTF... » Inserting text into the current cursor position
Inserting text into the current cursor position [message #21977] |
Sat, 13 June 2009 16:21 |
jeremy_c
Messages: 175 Registered: August 2007 Location: Ohio, USA
|
Experienced Member |
|
|
How can I insert text into the current cursor position? I have one control that I work in, but then I have templates that can be inserted into the main control. So, I am getting data from 1 RichEdit and want to insert it into another RichEdit.
I'm failing at finding out how to do this. Oh... I want to be able to scan the text I get from the template control, expand some values (such as ${DATE} or ${TIME}), and then insert the Qtf text into the current cursor position of the next RichEdit control.
Jeremy
|
|
|
|
|
|
Re: Inserting text into the current cursor position [message #22024 is a reply to message #21984] |
Sun, 14 June 2009 22:43 |
|
mirek
Messages: 13985 Registered: November 2005
|
Ultimate Member |
|
|
jeremy_c wrote on Sat, 13 June 2009 20:11 | I wound up, for the time being, using PasteText, and then using GetData() from the control the text was pasted into, then manipulating the string, then using SetData().
Is that an acceptable means?
Jeremy
|
Well, I spent several years refining these template techniques for my DB apps.
One (initial) approach was to keep templates as QTF. Later I have added "Editor" button.
One of aims of developing Esc was to provide scripting language for these templates. There is even "direct support" Expand function in the package.
Anyway, recent very superior approach is to (mis)use index entries. RichEdit has slightly altered interface capable of inserting some predefined parts, lake above "current date". These get inserted in actual form (actual date), but get marked as index entry, with value expressing that this text is date.
Later text can be regenerated to contain the real date.
The big advantage of this approach is that these templates can be created and edited by average users. Actually, if they use the insert button in normal editing of final document, they can even save such document as the new template.
The only part that is left to system administrator is the definition of those "inserted fields". There they get assigned Ids, names and QTF definition using Esc.
If this fits your usage, I can pack the package that provides this and post here. Maybe you can even refactor it to be included in bazaar:)
Mirek
|
|
|
|
|
Goto Forum:
Current Time: Sun Jun 16 15:32:47 CEST 2024
Total time taken to generate the page: 0.01585 seconds
|