[comp.windows.news] Help required with damaged events

cathy@cs.glasgow.ac.uk (Catherine Anne Wood) (04/05/89)

This time I think I am really going crazy ....

After discovering to my cost that depending on retained canvas for fixing
damage to items in a window is a BAD idea,  I have been trying to catch 
Damaged events to do my own damage repair.  However, it seems that 
Damaged events are not being generated ... or if they are they are too
elusive for me to catch !

The test program I am using is simply displaying two ButtonItems which 
are overlapped, and then unmapping one. It remains visible until I 
repaint the whole window and its contents.

Using eventlog, it appears that Damaged events are not generated for the
ButtonItems, (but are being generated for the window's canvas when it
is damaged).

I am expressing interest in damaged events for the ItemCanvas of 
ButtonItems (I think!) and the ItemCanvases are opaque.

I inserted the  interest in the TrackInterests dictionary (the same place
as the interests EnterEvent ExitEvent etc are set up in liteitem.ps) ...
 see code below.


/TrackInterests 10 dict  begin
	 % Code for Enter interests etc
	.....

	/ClientDamaged /Damaged {ItemBegin RepairDamage ItemEnd} null ItemCanvas
	        eventmgrinterest def
	end def
} def

TrackInterests is then passed to forkeventmgr i.e.
	/ItemEventMgr TrackInterests forkeventmgr def
	

RepairDamage (at the moment) just prints out a message on the console to
say it has been called .. this never happens.


I guess I am doing something wrong somewhere  .. can anyone help me
please ?


Thanks,
Cathy.

ARPANet: cathy%cs.glasgow.ac.uk@nss.cs.ucl.ac.uk 
JANET  : cathy@uk.ac.glasgow.cs	UseNet:  mcvax!ukc!cs.glasgow.ac.uk!cathy
Mail   : Cathy Wood, Computer Science, 17 Lilybank Gardens, GB-GLASGOW G12 8QQ : 041 339-8855 ext 6040

greg@cantuar.UUCP (G. Ewing) (04/17/89)

Catherine Anne Wood (cathy@cs.glasgow.ac.uk) writes:
>RepairDamage (at the moment) just prints out a message on the console to
>say it has been called .. this never happens.

I had a similar problem once.

If the repair routine never calls damagepath, then the after the first
damage event, NeWS won't give you any more, since it thinks you
haven't got the first one yet. damagepath clears the accumulated
damage path, allowing further damage events to occur.

The repairing code should look something like:

	damagepath clipcanvas
	% draw your stuff
	newpath clipcanvas

Greg Ewing				Internet: greg@cantuar.uucp
Spearnet: greg@nz.ac.cantuar		Telecom: +64 3 667 001 x8357
UUCP:	  ...!{watmath,munnari,mcvax,vuwcomp}!cantuar!greg
Post:	  Computer Science Dept, Univ. of Canterbury, Christchurch, New Zealand
Disclaimer: The presence of this disclaimer in no way implies any disclaimer.