Obscuring the cursor while you type

Bob Arning arning at charm.net
Fri May 7 17:35:22 UTC 1999


For those who want the cursor out of sight while you type, a filein is attached. If the keyboard focus responds true to #wantsObscuredCursor (the filein specifies such for TextMorphForEditView), then the cursor goes away when a keystroke occurs and reappears when a mouse event occurs. This seems to work, but my testing has been cursory.

Cheers,
Bob

==================filein below==============
'From Squeak 2.4b of April 23, 1999 on 7 May 1999 at 1:21:59 pm'!
Morph subclass: #HandMorph
	instanceVariableNames: 'eventSubscribers keyboardFocus mouseDownMorph mouseOverMorphs mouseOverTimes dragOverMorphs clickClient clickState firstClickEvent firstClickTime userInitials lastEvent eventTransform argument targetOffset damageRecorder cacheCanvas cachedCanvasHasHoles temporaryCursor temporaryCursorOffset grid gridOn remoteConnections transmitBuffer lastEventTransmitted lastWorldExtent menuTargetOffset hasChanged savedPatch suppressDrawing formerOwner formerPosition obscuredCursor obscuredCursorLocation '
	classVariableNames: 'DoubleClickTime NormalCursor PasteBuffer '
	poolDictionaries: ''
	category: 'Morphic-Kernel'!

!Object methodsFor: 'testing' stamp: 'RAA 5/7/1999 12:48'!
wantsObscuredCursor

	^ false! !


!HandMorph methodsFor: 'event handling' stamp: 'RAA 5/7/1999 13:21'!
handleEvent: evt
	
	eventSubscribers do: [:m | m handleEvent: evt].
"--"
	(evt anyButtonPressed and:
	 [evt controlKeyPressed and:
	 [lastEvent anyButtonPressed not]]) ifTrue:
		[eventTransform _ MorphicTransform identity.
		lastEvent _ evt.
		^ self invokeMetaMenu: evt].

		evt blueButtonPressed ifTrue:
			[lastEvent blueButtonPressed 
				ifTrue: [^ self specialDrag: evt]
				ifFalse: [eventTransform _ MorphicTransform identity.
						lastEvent _ evt.
						^ self specialGesture: evt]].
"--"
	lastEvent _ evt.
	self position ~= evt cursorPoint
		ifTrue: [self position: evt cursorPoint].

	evt isMouse ifTrue: [
		obscuredCursor ifNotNil: [
			obscuredCursorLocation = evt cursorPoint ifFalse: [
				obscuredCursor show. obscuredCursorLocation _ obscuredCursor _ nil
			].
		].
		evt isMouseMove ifTrue: [^ self handleMouseMove: evt].
		evt isMouseDown ifTrue: [ ^ self handleMouseDown: evt].
		evt isMouseUp ifTrue: [^ self handleMouseUp: evt]]. 

	evt isKeystroke ifTrue: [
		keyboardFocus wantsObscuredCursor ifTrue: [
			obscuredCursor ifNil: [
				obscuredCursor _ Cursor currentCursor.
				obscuredCursorLocation _ evt cursorPoint.
				Cursor blank show. 
			].      
		].
		keyboardFocus ifNotNil: [keyboardFocus keyStroke: evt].
		^ self].
! !


!TextMorphForEditView methodsFor: 'as yet unclassified' stamp: 'RAA 5/7/1999 12:53'!
wantsObscuredCursor

	^ true! !





More information about the Squeak-dev mailing list