Re: Setting the text without changing styling

Ron Benditt wrote:
> Is there a way to put a text string into an FTEditfield without
> changing the font and font size that is already set up in the
> FTEditfield?  Right now I'm doing this:
>
> FTEditfield.setText "ABC"
>
> This changes all of the font settings - not just the text itself.  To
> correct things, I have to refer back to a saved font style and then
> manually change the style myself after updating the text like this:
>
> FTEditfield.setText "ABC"
> FTEditfield.SelectAll
> FTEditField.changeFont "Times New Roman"
> FTEditField.changeSize 18
> FTEditField.changeTextColor &cA0A0A0
> FTEditField.DeselectAll
>
> As you can see, there is a whole lot more stuff to do just to do a
> simple text setting.  Am I missing something with this?  It seems to
> me that just calling .setText should not wipe out the current text
> style unless there are rtf commands in there that override this.
>
> Also, if its going to wipe out the text style, what style does it use
> as a replacement?  It seems to me that it should use the style that is
> defined as the .defaultFont, .defaultTextSize, and .defaultTextColor
> but this does not seem to be the case.


There are a couple of ways you could accomplish what you want.
The easiest way is to implement the DefaultParagraphStyle event.
This event is called when the FTC starts up. When the FTC wants to
create a new paragraph, which is the case when you call setText,
it will use this style as the template for the new paragraph.

FTC Website: http://www.truenorthsoftware.com/formattedtextcontrol
Set List Options (digest and vacation modes): www.freelists.org/list/ftcdev
List Archive: www.freelists.org/archives/ftcdev
Unsubscribe: Send email to ftcdev-request@xxxxxxxxxxxxx with "unsubscribe" in 
the subject field.



Other related posts: