[FIX] TargetOffset needs a hand

Peace Jerome peace_the_dreamer at yahoo.com
Sun Jul 18 05:18:39 UTC 2004


This is a repost of the Fix so it will be found by the
harvesters. See the BUG report with similar title for
more details on the problem.



'From Squeak3.7beta of ''1 April 2004'' [latest
update: #5967] on 17 July 2004 at 11:28:03 pm'!
"Change Set:		SetTargetsBugFix-wiz
Date:			17 July 2004
Author:			Jerome Peace (wiz)

For buttons and sliders #setTarget: is bizarrely
bugged. I've written about this elsewhere so I won't
document it here.

I believe this fixes target setting in
SimpleSliderMorph. If havesters agree then I hope they
will find someone to propagate the fix to buttons and
button properties.  And please reap out the bugged
setTarget methods from the image.  

Blind code copying has turned one bug into many. I
can't stress this enough bugged code was COPIED with
out ever being properly tested. Indeed it looks as if
tests containing the same bug were put into the menus
to hide the bug from being DETECTED. The result is
useless, unusable unused code being propogated as if
it were correct. 

Question for Harvesters: What should the Story for
targets of sliders and buttons be? For the fix I have
use the modified story for embed morph. I can also
imagine a story that says:

'to aquire a target for the button you drag the james
bond crosshair handle from the halo of the slider over
the object to be targeted and lift the mouse. If more
than on object is under the cross hair a menu is
given. If only the world paste up is under the cross
hair nothing is changed.'

Alternate to the menu idea the cross hair could pick
the topmost morph as target.

So harvesters what should the story be. Do you know
who would implement it?"!


!Morph methodsFor: 'meta-actions' stamp: 'wiz
7/17/2004 22:17'!
potentialTargets
	"Return the potential targets for the receiver.
	This is derived from
Morph>>potentialEmbeddingTargets."
	owner ifNil:[^#()].
	^owner morphsAt: self referencePosition behind: self
unlocked: true not! !

!Morph methodsFor: 'meta-actions' stamp: 'wiz
7/17/2004 23:27'!
targetWith: evt
	"Some other morph become target of the receiver"
	|  menu newTarget |
	menu _ CustomMenu new.
	self potentialTargets  do: [:m | 
		menu add: (m knownName ifNil:[m class name
asString]) action: m].
	newTarget _ menu startUpWithCaption: ( self
externalName, ' targets...').
	newTarget ifNil:[^self].
	self target: newTarget.! !


!SimpleSliderMorph methodsFor: 'menu' stamp: 'wiz
7/17/2004 22:34'!
addCustomMenuItems: aCustomMenu hand: aHandMorph

	super addCustomMenuItems: aCustomMenu hand:
aHandMorph.
	aCustomMenu addLine.
	aCustomMenu add: 'set action selector' translated
action: #setActionSelector.
	aCustomMenu add: 'change arguments' translated
action: #setArguments.
	aCustomMenu add: 'set minimum value' translated
action: #setMinVal.
	aCustomMenu add: 'set maximum value' translated
action: #setMaxVal.
	aCustomMenu addUpdating: #descendingString action:
#toggleDescending.
	aCustomMenu addUpdating: #truncateString action:
#toggleTruncate.
	aCustomMenu add: 'set target' translated action:
#targetWith: .
	target ifNotNil: [
		aCustomMenu add: 'clear target' translated action:
#clearTarget].
! !


!

Gzipped changeset attached. Please also see bug
report.

Yours in service,  Jerome Peace






		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SetTargetsBugFix-wiz.2.cs.gz
Type: application/x-gzip
Size: 1422 bytes
Desc: SetTargetsBugFix-wiz.2.cs.gz
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040717/cf6aeeae/SetTargetsBugFix-wiz.2.cs.bin


More information about the Squeak-dev mailing list