[HOWTO] get mouseEnter and mouseLeave when btn down
Karl Ramberg
karl.ramberg at chello.se
Thu Apr 12 21:31:18 UTC 2001
"montgomery f. tidwell" wrote:
>
> Howdy,
>
> what i want is for the morph to change colors when clicked. if
> when i click, i keep the btn down, i want it to revert to its
> original color if the mouse leaves its area, and change again
> (to the new color) of the mouse is brought back into the morph.
>
The following class do at least some of this:-). Note that in the halo
menu there is a drag and drop setting for the morph. That must be on
to send dragging events.
Karl
'From Squeak3.1alpha [latest update: #''Squeak3.1alpha'' of 23 February
2001 update 3910] on 12 April 2001 at 11:22:40 pm'!
RectangleMorph subclass: #YeahMorph
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Newstuff'!
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:10'!
handlesMouseOver:evt
^true! !
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:17'!
handlesMouseOverDragging: evt
^true! !
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:14'!
mouseEnter:evt
self color: Color red! !
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:18'!
mouseEnterDragging:evt
self color: Color red! !
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:14'!
mouseLeave:evt
self color: Color blue! !
!YeahMorph methodsFor: 'as yet unclassified' stamp: 'kfr 4/12/2001 23:22'!
mouseLeaveDragging:evt
self color: Color blue! !
More information about the Squeak-dev
mailing list
|