Hmmmm. I've already created a class that uses regex. I decided against
instr because of text length and the fact that I'm running it several times
(I have field value tags, code tags, and placement tags). I'm trying to get
it to work with rtf so that I don't have to make style tags!
I'll leave that as a last resort. I think I'm going to tinker with using
the clipboard first...
~joe
-----Original Message-----
From: realbasic-nug-bounces at lists dot realsoftware dot com
[mailto:realbasic-nug-bounces at lists dot realsoftware dot com] On Behalf Of
Charles
Yeomans
Sent: Monday, February 28, 2005 5:05 PM
To: REALbasic NUG
Subject: Re: object=object
On Feb 28, 2005, at 5:34 PM, Joseph Claeys wrote:
> "For Mac builds, it would be EditField2.SetTextAndStyle
> EditField1.Text, EditField1.TextStyleData." Charles Yeomans
>
> So Win doesn't have that option?
>
> Here is where I'm falling down:
>
> I have a function that takes an editfield (or a string it's
> overloaded), a tag, and a dictionary. So it used to look like this
> and work just
> fine:
>
> s=jp.TagReplace(s,"<<(.*)>>",FieldValues)
>
> S is a textstring that is obtained from a text document and that might
> look like this "<<firstname>> is a student at <<schoolname>> that
> began <<grade>>" etc. The dictionary has fields and values. After
> running through my TagReplace Function I get back a real nice string
> that has all the values inserted ::pats himself on the back::
>
> Now I'm passing an editfield... The original idea was that wouldn't
> have to deal with all that styled nonsense directly. The editfield is
> getting the same kind of string but from an rtf. Anyway it seems that
> I can only get back either the text or the style data unless I run it
> through the function twice (or return an ADT that has a couple of
> properties). So now I'm staring at this:
>
> StyleField.text=jp.TagReplace(StyleField,"<<(.*)>>",FieldValues).text
>
> And wondering how to proceed... I don't see a single method that will
> give me the style and the text in one fell swoop (I would have thought
> that something called styledtext would do this - but no joy on that
> count).
>
> Could someone set me straight? I think I'm missing something really
> fundamental because this seems doable without all the code gymnastics
> that I keep seeing as possible solutions.
>
Don't replace the entire text of the EditField. Instead, use
EditField.SelText to replace only the text that requires replacing.
See
<http://www.quantum-meruit.com/rb/Articles/
HowDoI.html#editFieldReplace>.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|