Get styledText into TextArea quickly?

Hi,

as I query a database I assemble a styledText st from a number of styleRuns (aka the sql used and the query results)

I then put that styledText into a TextArea with

TA_Report.StyledText = st

but it takes aaaaaages.

The queries and the making of the styled<Text are quick, it is just populating the textArea which is incredibly slow.

I tried

TA_Report.StyledText.RTFData = st.RTFData

but that is even worse.

After looking around I came across this in the MacOSlib but maybe I’m using it wrongly:

#if TargetCocoa then dim tv as new NSTextView( TA_Report ) dim ts as NSTextStorage = tv.TextStorage ts.BeginEditing TA_Report.StyledText = st ts.EndEditing #else TA_Report.StyledText = st #endif

So how do you quickly assign a styledText object to a TextArea on MacOS X?

I’ve never noticed any slowdown with populating styled text in this manner, but I don’t know the size of your sample. If you work a lot with styled text, you might want to check out the Formatted Text Control from BKeeney Software.
link text

5200 characters, 568 lines (many of which are empty)

I know you’re not normally interested in a 3rd party plugin solution, Markus, but for the sake of others who may find this post and want a solution (including one that involves a 3rd party plugin), the MBS Win plugin solved the exact same problem for me very quickly. I’m pulling in well over 10,000 characters (not exactly sure how many lines … it’s prose-style, paragraph text including indented bulleted lists) and there is no detectable delay once I hit the button that starts the populating process.

    // populate the notes template with the Notes field contents from rsGen record set (caseModel table)
    Dim cID As String = rsGen.Field("CaseID").StringValue
    
    Dim rs As RecordSet = db.SQLSelect("SELECT NotesData FROM Notes WHERE CaseID='" + cID + "'")
    
    dim ss As String = rs.Field("NotesData").StringValue
    
    if NOT rs.Field("NotesData").Value.IsNull THEN
      for iloop As Integer = 0 to Ubound(oContainers)
        
        if oContainerIndex(iloop) = "nc" then
          
          cntNotes(oContainers(iloop)).TANotes.WinRTFDataMBS = ss
          
          Exit For
        end if
        
      next
    end if
    
    rsGen.Close  // close the record set
    

I think you might mistake me for someone else :wink:

I actually have the MBS plugins (older version) just haven’t done anything with them yet - they can be a bit intimidating.

[quote=135543:@Markus Winter]I think you might mistake me for someone else :wink:

I actually have the MBS plugins (older version) just haven’t done anything with them yet - they can be a bit intimidating.[/quote]

I use them homeopathically, on a case by case basis, but am amazed every time by their power. I know I will never know all that is there anyway :wink:

OK, Markus … gotta admit it … you just put the biggest smile that’s graced my sorry face all day today ^^

If it wasn’t for Christian’s help (and a lot of it, too!), I’d be echoing that comment (although the MBS examples are very good, the online documentation is often confusing to me … but man, once you figure it out, to Michel’s point, it’s “magic”!)

There have been a number of threads about this, and there are several solutions (the ones I know of are OS X-specific). Here’s one longish thread:

https://forum.xojo.com/761-please-fix-extraordinarily-slow-parser-for-rtfdata

I know:

:wink:

I use the method in Axel Schneider’ post here https://forum.xojo.com/10186-troubles-with-rtf

It load instantly.