FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

TEXT

Copy text to the Clipboard


Try something like this :

TEHndl&=TEHANDLE(whichEF):' gets a pointer to edit field
TELen=TEHndl&..teLength%:' gets the length of text in field
MemBlock&=FN NEWHANDLE(TELen):' create a new handle for the rez
TxtHndl&=TEHndl&..teTextH&:' gets the handle to text
LONG IF MemBlock&:' did we create one
  OSErr=FN HLOCK(MemBlock&):' and lock the block now
  BLOCKMOVE [TxtHndl&],[MemBlock&],TELen:' copy the data over now
  OSErr=FN ZEROSCRAP:' clear out the scrap first
  OSErr=FN PUTSCRAP(TELen,_"TEXT", [MemBlock&]):' copy to clipbrd
  OSErr=FN HUNLOCK(MemBlock&):' now unlock the handle
  OSErr=FN DISPOSHANDLE(Hndl&):' clear out & handle and data
END IF

or even easier :

toCopy$ = EDIT$(1)
OSErr=FN ZEROSCRAP:' clear out the scrap first
LONG IF OSErr=_noErr:' make sure we could do it
  OSErr=FN PUTSCRAP(LEN(toCopy$),_"TEXT",@toCopy$+1):'put on clip
END IF

Mel Patrick