Re: Questions about FTC's capabilities

  • From: Brendan Murphy <bmurphy@xxxxxxxxxxxxxxxxxxxxx>
  • To: ftcdev@xxxxxxxxxxxxx
  • Date: Mon, 14 Jul 2008 13:09:34 -0500

Joe Strout wrote:
OK. How is content represented in the FTC? Is there some little class hierarchy similar to RB's StyledText data? Or is it all internal magic? (I'm wondering whether I could instead just walk the style runs and embedded objects myself, and have a decent chance of drawing the same way FTC does.)

Alternatively, the FTC must have a "Draw" method somewhere (that is invoked by its Paint event, and also invoked whenever the content changes). Any chance that is (or could be made) public, and given a Graphics parameter, so I can just tell my off-screen FTC to draw *here* (and give it the result of some Graphics.Clip call)?

To see a partial listing of the data structures involved look at
the user guide (page 4). When the content is composed in the FTC
it does all the hard work of composing the lines, paragraphs, and
pages. These data structures are separate from the uncomposed data
structures which comprise the document as it is written out to a
file. In the demo application when you save to the xml format you
will see the nature of the uncomposed data. So you have two lines
of data structures you can walk through depending on what you want
to accomplish. I rolled my own style text data structures because
there are problems with how RB designed and implemented their own.

I think there may be is a simpler way to do this. The FTC is
doubled buffered and you can copy the contents of the display
buffer to your target control. That way you let the FTC do all the
rendering and just blit the display to your target canvas.

BTW, in my experimentations with Graphics.Clip and the FTC was
that the clip functionality is horribly flawed under the hood in
that it really slows things down.

2. Can I make an editable FTC area that's just a rectangular area of a canvas, rather than the whole thing? (I generally try to avoid layer canvases on top of each other, but I guess we could try that if necessary.)

No, it is not designed to do that.

OK, that's understandable, since there are a whole lot of events that have to be hooked up for actual editing. Perhaps moving a second (FTC) canvas on top of the main one will work.

That is what I would try first. That way if it works, you get the
whole works with no effort. The problem on Windows is combating
flicker, but there are ways to handle that. I generally don't
overlay controls because the of the bad karma people
have reported on the NUG for doing so, so I can't tell you what
other problems you might run in to when you try overlaying
controls.

3. Can I link two editable areas together, so that content flows from one to another? (Picture a multi-column newsletter layout, where text that flows off the end of column 1 goes to the top of column 2.)

It is not designed to do that, but you do have access to the
source code, which makes it possible. The question would be if it
is feasible?

Right. This is the sort of thing that's hard to bolt on afterward, if it wasn't at least in mind in the original design. But perhaps we'll get lucky and FTC's design will be conducive to it.

Since I am the original designer, I can say that it wasn't a goal
of version 1.0 to support multiple columns. This is something I
have been considering as a 2.0 feature in the future. Multiple
column support needs to be done in the guts of the FTC in order to
be done right and efficiently. The code is well commented, so
maybe there is an easy way to do it that I haven't considered. You
are welcome to experiment with it which is why I made it open
source. Note, column support will require that I implement
"section" support like in Microsoft Word otherwise an entire
document would only display multiple columns. This is why I think
I need to do this.

FTC Website: 
http://www.truenorthsoftware.com/FormattedTextControl/FormattedTextControl.html
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: