Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
jeremy_c is currently offline  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 #21978 is a reply to message #21977] Sat, 13 June 2009 19:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11864
Registered: November 2005
Ultimate Member
PasteText.

Mirek
Re: Inserting text into the current cursor position [message #21979 is a reply to message #21978] Sat, 13 June 2009 22:32 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
How do I go about altering the text? i.e. The text from the source editor may contain ${DATE} and I wish to replace it with Format("%`", GetSysDate())

Jeremy
Re: Inserting text into the current cursor position [message #21984 is a reply to message #21977] Sun, 14 June 2009 02:11 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
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
Re: Inserting text into the current cursor position [message #22024 is a reply to message #21984] Sun, 14 June 2009 22:43 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11864
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
Re: Inserting text into the current cursor position [message #22033 is a reply to message #22024] Mon, 15 June 2009 00:55 Go to previous messageGo to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
I'd love to see the code and work with it. Sounds like it's right up my alley.

Jeremy
Re: Inserting text into the current cursor position [message #22133 is a reply to message #22033] Fri, 19 June 2009 10:42 Go to previous message
mirek is currently offline  mirek
Messages: 11864
Registered: November 2005
Ultimate Member
Sorry for the delay...
  • Attachment: IdisTDoc.zip
    (Size: 17.38KB, Downloaded 184 times)
Previous Topic: Spelling Button on RichEdit
Next Topic: how get font height
Goto Forum:
  


Current Time: Sun May 26 18:14:17 CEST 2019

Total time taken to generate the page: 0.01052 seconds