[BUG] dragging script phrases from parts bins

Aran Lunzer aran at meme.hokudai.ac.jp
Wed Apr 26 04:17:10 UTC 2000


Hi -

In case this problem has already been found and fixed while I wasn't
looking...


[On plain v2.7, updated to #1782] if you have an entire Morphic
scripting phrase (not just a value phrase) sitting in a parts bin, then
drag it out to become or to supplement an active script, the dropped
object doesn't get told that it has left the parts bin.  Therefore you
can't edit values (e.g., numbers) within the phrase: as soon as you
click on a string, the whole phrase comes away in your Hand.

It turns out that doing the "right thing" here is pretty hairy.  Maybe
some of you drag-&-drop folk have already re-vamped the whole scene
anyway...

Basically the issue is that the existing code postpones switching off
the `parts donor' effect until it invokes justDroppedInto:event:, once
the drop is confirmed as having taken place.  But since what ends up in
the world is not necessarily the original grabbed object (but perhaps a
copy, or something with that object embedded within it), it's difficult
for the code to figure out exactly which object(s) to tell to stop being
donor-like.  I've run into a couple of cases where it fails.

The first is when a phrase is dropped directly onto the PasteUpMorph. 
In this case, handled within PasteUpMorph>>morphToDropFrom:, a new
script is built (assuming preferences are set that way), and the grabbed
object is copied and mangled in various ways.  A simple workaround for
this case seems to be to leap in early with 

	aMorph isPartsDonor: false.

- for example, just after these lines [in the 16 Jul 99 version]:

	(aMorph isKindOf: PhraseTileMorph) ifFalse: [^ aMorph].
	aMorph isCommand ifFalse: [^ aMorph].
	(actualObject _ aMorph actualObject) ifNil: [^ aMorph].
	

The other case is where a phrase is dropped into an existing script, and
it picked up by ScriptEditorMorph>>acceptDroppingMorph:event:.  Again
the original object is munged during the processing, and again the
problem seems to go away if you put 

	aMorph isPartsDonor: false.

into 
	(aMorph isKindOf: PhraseTileMorph)
	   ifTrue: [aMorph unbrightenTiles.  **here**].



So... it's a workaround (or at least, an I-think-it-worksaround).  But
does anyone have a more kosher fix?


Bye for now

Aran
-- 
Aran Lunzer                 aran at bigfoot.com
Meme Media Laboratory       lab: +81 11 706 7262 / fax 7808
Hokkaido University    
Sapporo 060-8628, JAPAN     http://ca.meme.hokudai.ac.jp/people/aran/





More information about the Squeak-dev mailing list