Article # 647, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
Fonts in text transfer items
Q. Has anyone played with making text transfer items? I'd like to know how to set the font of the text that goes into the transfer item. Using the obvious MSG_VIS_TEXT_SET_FONT_ID doesn't have any effect. It's as if it ignores whatever properties the text has when making the clipboard transfer item. A. When using TextAllocClipboardObject() the second variable determines what type of text object to create. It's a VisTextStorageFlags type. To transfer multiple character attributes you would use: VMFileHandle hfilTransfer; optr odText; VMBlockHandle hvmTransferItem; hfilTransfer = ClipboardGetClipboardFile(); odText = TextAllocClipboardObject( hfilTransfer, VTSF_MULTIPLE_CHAR_ATTRS, 0 ); You now have a text object that you can use all your regular messages on, such as: FontID fid = FID_UNIVERSITY; @call odText::MSG_VIS_TEXT_REPLACE_ALL_PTR( "Some text", 0 ); @call odText::MSG_VIS_TEXT_SET_FONT_ID( fid, TEXT_ADDRESS_PAST_END, 0 ); Then finish up with: hvmTransferItem = TextFinishWithClipboardObject( odText, TCO_RETURN_TRANSFER_ITEM, ConstructOptr( GeodeGetProcessHandle(), NullChunk ), "Test text" ); This is explained in Include\Objects\vTextC.def. Search for TextAllocClipboardObject.