Re: SelectAll Question

  • From: Brendan Murphy <bmurphy@xxxxxxxxxxxxxxxxxxxxx>
  • To: ftcdev@xxxxxxxxxxxxx
  • Date: Sun, 22 Mar 2009 09:41:07 -0500

Bob Keeney wrote:
> Okay, I do a SelectAll on the FTC so i can change my font, size, etc
> of all text in the control.  So how do I clear the selection
> programmatically so that the selection is cleared (but the text is
> still there) and the insertion point is at the end of the selection?


Here is some code you can put in the demo's Help->Test menu
handler for you to play with. You can use the change methods on
FTDocument to change the characteristics you need to change and
then make one call to update at the end. This will preserve the
selection and insertion point.

Obviously you can make it slightly more efficient.

Dim doc as FTDocument
Dim startPos as FTInsertionOffset
Dim endPos as FTInsertionOffset

' Get the document.
doc = TestDisplay.getDoc

startPos = new FTInsertionOffset(doc, 0, 0)
endPos =  new FTInsertionOffset(doc, doc.getParagraphCount - 1, _
doc.getParagraph(doc.getParagraphCount - 1).getLength)

doc.changePlainStyle(startPos, endPos, true)

TestDisplay.update(true, true)

' We handled it.
return true
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: