Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace acceptDroppingMorph was missing an assignment #118

Open
jpenneygit opened this issue Feb 24, 2024 · 0 comments
Open

Workspace acceptDroppingMorph was missing an assignment #118

jpenneygit opened this issue Feb 24, 2024 · 0 comments

Comments

@jpenneygit
Copy link

I think I fixed it, the original on my image was missing the assignment (this is approximate, i didn't record the original code exactly):

(dropee isKindOf: TransferMorph)
	ifTrue: [reference := dropee passenger.
		externalName := dropee passenger className]
	ifFalse: [reference := dropee.
      ].

And instead just left externalName as nil, so when you got to "externalName := externalName isOctetString" it reported an unknown object.

I changed it to:
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
externalName := dropee externalName].

(just adding the assignment to externalName)

This was a Squeak 5.1 32 bit image, You should be able to just look at the code and it's obviously wrong. If you want to reproduce, open a workspace, open any new morph with openInWorld, set the workspace to create textual references to dropped morphs, and drag and drop the morph on the workspace.

I'm trying to build a GUI, pretty much a beginner.

Here's the fixed code:

acceptDroppingMorph: dropee event: evt inMorph: targetMorph
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName reference |
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
externalName := dropee externalName].
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName withFirstCharacterDownshifted , reference identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: reference.
(dropee isKindOf: TransferMorph)
ifFalse: [dropee rejectDropMorphEvent: evt].
^ true"success"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant