Subject: Mapped canvas in LiteWindow

From: [email-masked] (J|rgen Lindskov Knudsen)
Date: Sat, 17 Oct 87 13:17:13 EST

Could anyone please explain to me, why the program-fragment below doesn't
work?  My intention is to have two canvas in a window, and that both
canvas have a button on it, where the action of the buttons is to unmap
the canvas with the button, and then map the other canvas.  The two
canvas are called can1 and can2.  In the ideal world they should both
be children of the ClientCanvas of the window (here called "can").
But this doesn't work -- it seems as if changing the Mapped attribute
of the canvasses doesn't make any difference (except for input).
In order to illustrate the intented behaviour, I have changed the
parent of can1 to be the framebuffer, AND THEN ALL WORKS AS INTENDED
W.R.T. CAN1.  What's the problem?

+---------------------------------+-------------------------------------------+
|    Jorgen Lindskov Knudsen	  |                                           |
|    Computer Science Department  | phone:   +45 6 12 83 55                   |
|    Aarhus University	      	  | telex:   64767 aausci dk                  |
|    Ny Munkegade 116	      	  | e-mail:  [email-masked] -or- [email-masked] |
|    DK-8000 Aarhus C, DENMARK.   |                                           |
+---------------------------------+-------------------------------------------+

systemdict /Item known not { (NeWS/liteitem.ps) run } if
/win framebuffer /new DefaultWindow send def
   { /PaintClient {random fillcanvas
      		   PaintCan1 PaintCan2
		  } def
     /FrameLabel (Main Window) def
     50 50 1000 700 reshape
   } win send
/can win /ClientCanvas get def
/map win send

/can1 framebuffer 300 200 createcanvas def
	can1 setcanvas 100 100 movecanvas
	/PaintCan1 { can1 setcanvas .9 fillcanvas [button1] paintitems } def
	/button1 (1) /action1 can1 50 50 /new ButtonItem send
	       		20 20 /move 3 index send def
	/action1{  can2 mapcanvas (map can2 send\n) print
          	   can1 unmapcanvas
		} def
	[button1] forkitems

/can2 can 300 200 createcanvas def
	can2 setcanvas 500 100 movecanvas
	/PaintCan2 { can2 setcanvas .7 fillcanvas [button2] paintitems } def
	/button2 (2) /action2 can2 50 50 /new ButtonItem send
	       		20 20 /move 3 index send def
	/action2{  can1 mapcanvas (map can1 send\n) print
          	   can2 unmapcanvas
		} def
	[button2] forkitems
can2 mapcanvas