earley@modular.com (Joe Earley) (05/17/91)
I'm running TNT-FCS on OpenWindows 2.0 on SunOS 4.1.1. Do the following to see my problem: 1) Start OpenWindows 2) Start the program 3) Select the XHair button and the Hairy option 4) Press the left button in the center canvas and move the x-hair around 5) Release the left button 6) Note the refcnt results in the console window 7) From the window menu select Quit 8) pam the window to get rid of it 9) Repeat steps 2 through 7 and the window will disappear The refcnt for the first run of the program returns 2 0. The refcnt for all subsequent runs will return 1 0. If the %framebuffer createoverlay pop line is uncommented the refcnt will always be 1 0. Why does the first overlay canvas get created with 2 hard links to it? Where is the second link? Also, I'ld like to install my own cross-hair cursor in the cursorfont dictionary. After reading the manual I still don't know how to go about doing it. I'ld settle for just making my own cursor on the overlay canvas if I could get the default pointer cursor to temporarily go away. Could anyone enlighten me on this? Last item: is there a way to get the error messages to always print on the console window? Doing a currentprocess /Stderr (/dev/console) (w) file put didn't get me anywhere. In my cps application the NeWS errors are always sent up the socket which kills my window. This forces me to do round-about debugging to find out what the error messages were. If any of the answers to the above are obvious please feel free to flame me for burdening the net with stupid questions, but how about an answer anyway? Here is the program: ------------------------------------------------------------------------------ #! /bin/sh psh <<"End_Of_PS" % Uncomment next line and everything works %framebuffer createoverlay pop /ClassCenterCanvas ClassCanvas [] classbegin /Paint { 0 setgray fill } def /TrackStart { % event => [tracking actions] true pop gsave % grestored in /TrackStop self createoverlay setcanvas debugdict begin console (refcnt = % %\n) [ currentcanvas refcnt ] fprintf end [ /TrackStop /TrackMotion ] true } def /TrackMotion { % event => - begin XLocation YLocation end % XLocation YLocation /location self send % XLocation YLocation x y exch 4 1 roll sub % x XLocation (YLocation-y) 3 1 roll exch sub % (YLocation-y) (XLocation-x) [=] y1 x1 erasepage % Draw a cross-hair % dup 25 sub % y1 x1 x1-25 2 index moveto % y1 x1 dup 5 sub % y1 x1 x1-20 2 index lineto % y1 x1 dup 5 add % y1 x1 x1+5 2 index moveto % y1 x1 dup 25 add % y1 x1 x1+25 2 index lineto % y1 x1 dup 2 index 25 sub % y1 x1 x1 y1-25 moveto % y1 x1 dup 2 index 5 sub % y1 x1 x1 y1-20 lineto % y1 x1 dup 2 index 5 add % y1 x1 x1 y1+5 moveto % y1 x1 exch 25 add % x1 y1+25 lineto 1 setgray stroke } def /TrackStop { % event => - pop erasepage grestore % for the gsave in /TrackStart false /settrackable self send } def /XHairHandler { % itemindex menu => - pop pop true /settrackable self send } def classend def /MyBaseWindowClass ClassBaseWindow [] classbegin /NewInit { /NewInit super send dictbegin % Drawing Canvas % /DrawingCanvas framebuffer /new ClassCenterCanvas send def /Center DrawingCanvas /addclient self send % Button Panel % /ButtonPanel /Calculated framebuffer /new ClassPanel send def % Create the XHair button and menu % /XHairMenu /Grid framebuffer /new ClassMenu send def [ [ (Hairy) /XHairHandler ] ] /setitemlist XHairMenu send DrawingCanvas /settarget XHairMenu send /XHairButton /Grid framebuffer /new ClassMenuButtons send def [ [ (XHair) XHairMenu ] ] /setitemlist XHairButton send /XHairButton XHairButton [/West { /West PARENT POSITION }] /addclient ButtonPanel send /North ButtonPanel /addclient self send dictend pop } def classend def /win null framebuffer /new MyBaseWindowClass send def 0 0 300 300 /reshape win send /new ClassEventMgr send /activate win send /map win send newprocessgroup currentfile closefile End_Of_PS ------------------------------------------------------------------------------ Thanks. Joe Earley, Modular Mining Systems USENET: {cmcl2,noao,uunet}!arizona!modular!earley INTERNET: modular!earley@cs.arizona.edu