Helene two key things: - look for senders - put a halt there and check at worse you crash the system :) Stef On Sep 24, 2012, at 9:28 AM, Helene Bilbo wrote:
Thanks for investigating my issue - and for documenting how you did so! That's interesting to read. I would not have found the right way to modify and halt the dispatchDefault: anEvent with: aMorph method myself.. Something like this would be a nice screencast for beginners on PharoCasts. helene.
Stéphane Ducasse wrote
What is really strange is that the event location is always too large. I put the dropZone on 0@0 - 200@200 and I drop a file on it and the event location is 15@800â¦. I traced that up to HandMorphâ¦processEvents and this is event in the evtBuf of the vm.
Stef
dispatchDefault: anEvent with: aMorph "Dispatch the given event. The event will be passed to the front-most visible submorph that contains the position wrt. to the event." | localEvt index child morphs inside | "See if we're fully outside aMorphs bounds" (anEvent class = DropFilesEvent ) and: [(aMorph class = DropZone) ifTrue: [self halt]]. (aMorph fullBounds containsPoint: anEvent position) ifFalse:[^#rejected]. "outside" "Traverse children" index := 1. morphs := aMorph submorphs. inside := false. [index <= morphs size] whileTrue:[ child := morphs at: index. localEvt := anEvent transformedBy: (child transformedFrom: aMorph). (child processEvent: localEvt using: self) == #rejected ifFalse:[ "Not rejected. The event was in some submorph of the receiver" inside := true. localEvt wasHandled ifTrue:[anEvent copyHandlerState: localEvt]. index := morphs size. "break" ]. index := index + 1. ].
"Check for being inside the receiver" inside ifFalse:[inside := aMorph containsPoint: anEvent position event: anEvent]. inside ifTrue:[^aMorph handleEvent: anEvent]. ^#rejected
-- View this message in context: http://forum.world.st/Problems-with-a-Morph-that-accepts-File-Dropping-in-Ph... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.