tips
[Top] [All Lists]

Copying styled text to the clipboard

To: "REALbasic Tips" <realbasic-tips at lists dot realsoftware dot com>
Subject: Copying styled text to the clipboard
From: Geoff Perlman <geoff at realsoftware dot com>
Date: Wed, 09 Aug 2000 17:33:27 -0500
If your application made with REALbasic uses styled text in editfields, you might want to provide the user with the ability to copy the text along with the style info (font, fontsize, styles) to the clipboard. If you simply copy the text property of the editfield to the clipboard, the user will get the text but without any font, fontsize or style. Fortunately, there is a very
easy way to include the style data.

The example below copies the text from editfield1 to the clipboard then adds
the style data as well.

dim c as clipboard
c = new clipboard
c.text = editField1.text
c.addmacdata(editfield1.textstyledata,"styl")

This tip was inspired by Jason Parsley and Dave Grogono both of REAL
Software, Inc.
--

Geoff Perlman
President & CEO
REAL Software, Inc.
http://www.realsoftware.com
mailto:geoff at realsoftware dot com
Phone: 512-263-1233 x711
Fax:   512-263-1441



 - - - - - - - - - -
Got a useful tip to share? Send it to us at:
REALbasic-tips at lists dot realsoftware dot com dot
For list commands, send "Help" in the body of a message to
<requests at lists dot realsoftware dot com>



<Prev in Thread] Current Thread [Next in Thread>
  • Copying styled text to the clipboard, Geoff Perlman <=