Rich Love wrote: >I don't see how it can work. >There is no sample text to print. >The window is blank. >In your BuildNewWindow routine, you never create any text (just a >handle) Rich, Robert indeed built some text in the window, but it's funky text. You see, Robert is a genius extraordinaire par excellence. When he needs text for a demo, being of left-brained scientific persuasion, he is happy with any kind of text. In the original code below I show (by SHOUTING in all caps) where he builds his funky random letters and then places them into a handle which is then attached to the window. >local mode >local fn BuildNewWindow >'~'1 >dim as long untitledNum >dim as Str255 wTitle, demoTextString >dim as Handle @ contentH >dim as long j, length >dim as Ptr textP >dim as OSStatus err > >wTitle = "Untitled" >untitledNum = fn NextNewWindowCount >if ( untitledNum > 1 ) then wTitle += str$( untitledNum ) >window fn NextFBWindowNum, wTitle -------------------------------------------- ROBERT CREATES SOME RANDOM TEXT HERE AND PLACES THAT TEXT INTO THE NICE NEW HANDLE "contentH" HERE: -------------------------------------------- // invent some "text" contentH = fn NewHandle( 150 ) length = fn GetHandleSize( contentH ) HLock( contentH ) textP = [contentH] while ( length ) long if ( rnd( 10 ) == 1 ) textP.nil`` = 13 xelse textP.nil`` = "a" - 1 + rnd( "z" - "a" + 1 ) end if textP++ length-- wend HUnlock( contentH ) -------------------------------------------- FUNKY RANDOM TEXT IS NOW IN THE HANDLE "contentH" READY TO BE ATTACHED TO THE WINDOW IN THE FOLLOWING FUNCTION: -------------------------------------------- // attach it to the window as a WindowProperty err = fn SetWindowProperty( window( wndRef ), kMyAppSignature, ¬ kMyDocContentProperty, sizeof( Handle ), @contentH ) end fn '_______________________ Now, to Robert's left brain, this is perfectly wonderful text for his masterful demo which is not about putting text into handles. but printing in Carbon. However, this funky random text presents a major challenge for we who are left-brain challenged: When we want to see text, we want to see text. Random undecipherable characters in a window are quite upsetting... ...Kinda like when your kids squeeze the toothpaste from the center rather than neatly rolling the tube. Enter Lewis Carroll. Take my code below and we will build a container "gC" and fill that container with "Jabberwocky" borrowed from Lewis Carroll's "Through the Looking Glass." Jabberwocky is excellent right brain material, something very easy for use to...uhhhh... get a handle on, so to speak. Now in this code, we have to do a couple of things. In Robert's demo, I come up with _kPMGraphicsContextQuickdraw as not being defined. Now here is my botched definition for the top of the file. Not pretty, but it works: _kPMGraphicsContextQuickdraw$ = "com.apple.graphicscontext.quickdraw" Next in the globals we need to define our container: dim as container gC end globals To fill the container the Jabberwocky prose, we simple call the function fn FillContainer. Getting a handle to the container is as simple as: contentH = [@gC] Doing this we dump the container contents into the handle. Once the handle is full with Jabberwocky text, we can empty the container. gC = "" Then we can plunk our handle full of text into the window with fn SetWindowProperty. Here it is in FB^3 parlance: '---------- STICK THIS UP WITH THE GLOBALS-------- _kPMGraphicsContextQuickdraw$ = "com.apple.graphicscontext.quickdraw" dim as container gC end globals '-----Sub these functions for the old fn BuildNewWindow local fn FillContainer gC += "'Twas brillig, and the slithy toves" + chr$(13) gC += "Did gyre and gimble in the wabe;" + chr$(13) gC += "All mimsy were the borogoves," + chr$(13) gC += "And the mome raths outgrabe." + chr$(13) + chr$(13) gC += """Beware the Jabberwock, my son!""" + chr$(13) gC += "The jaws that bite, the claws that catch!" + chr$(13) gC += """Beware the Jubjub bird, and shun" + chr$(13) gC += "The frumious Bandersnatch!""" + chr$(13) + chr$(13) gC += "He took his vorpal sword in hand:" + chr$(13) gC += "Long time the manxome foe he sought--" + chr$(13) gC += "So rested he by the Tumtum tree," + chr$(13) gC += "And stood awhile in thought." + chr$(13) + chr$(13) gC += "And, as in uffish thought he stood," + chr$(13) gC += "The Jabberwock, with eyes of flame," + chr$(13) gC += "Came whiffling through the tulgey wood," + chr$(13) gC += "And burbled as it came!" + chr$(13) + chr$(13) gC += "One two! One two! And through and through" + chr$(13) gC += "The vorpal blade went snicker-snack!" + chr$(13) gC += "He left it dead, and with its head" + chr$(13) gC += "He went galumphing back." + chr$(13) + chr$(13) gC += """And hast thou slain the Jabberwock?""" + chr$(13) gC += "Come to my arms, my beamish boy!" + chr$(13) gC += """O frabjous day! Callooh! Callay!""" + chr$(13) gC += "He chortled in his joy." + chr$(13) + chr$(13) gC += "'Twas brillig, and the slithy toves" + chr$(13) gC += "Did gyre and gimble in the wabe;" + chr$(13) gC += "All mimsy were the borogoves," + chr$(13) gC += "And the mome raths outgrabe." + chr$(13) end fn //local mode <---- Rem this so our function can see the container local fn BuildNewWindow '~'1 dim as long untitledNum dim as Str255 wTitle, demoTextString dim as Handle @ contentH dim as long j, length dim as Ptr textP dim as OSStatus err wTitle = "Untitled" untitledNum = fn NextNewWindowCount if ( untitledNum > 1 ) then wTitle += str$( untitledNum ) window fn NextFBWindowNum, wTitle '---- Right brain replacement for R.P.'s funky random text handle fn FillContainer contentH = [@gC] gC = "" // attach it to the window as a WindowProperty err = fn SetWindowProperty( window( _wndRef ), _kMyAppSignature, ¬ _kMyDocContentProperty, sizeof( Handle ), @contentH ) end fn '---------------- END SUB --------------------- Oh frabjous day! Callooh! Callay! Ken