Cmd/Ctrl/Cmd-shift keys on windows (was Re: "File in" dialogbox

Bob Arning arning at charm.net
Wed Mar 14 11:57:47 UTC 2001


Bijan,

I have attached some code to file in that will report keystrokes received fairly early in the process. This may help in understanding what's happening in each case.

On Tue, 13 Mar 2001 20:57:58 -0500 (EST) Bijan Parsia <bparsia at email.unc.edu> wrote:
>cmd-return: returns and indents.
>ctrl-return: deletes everything.

These work the same on the Mac and the only difference in what my code report is that one says CONTROL and the other says COMMAND.

>cmd-': single quotes selection.
>cmd-shift-': nothing.
>ctrl-': nothing.

It would be interesting to compare what you are actually getting in these cases.

>cmd-shift/ctrl-9: nothing.

So, do you get keystrokes reported here?

>cmd-shift/ctrl-b: works
>cmd-shift/ctrl-f: works.
>cmd-shift/ctrl-a: works.
>cmd-shift/ctrl-s: dunno.

Control-s is subtle. It's like cmd-g.

>Whatever-\: doesn't work.
>
>of the enclosers, only cmd-' works (not even ctrl-').
>
>Oops. cmd-[ works, but not ctrl.
>
>Oops. cmd-, works, but not ctrl or cmd-shift.

Sounds in general like many control key combos are not getting through or have values that are not what Squeak expects.

Cheers,
Bob

-----code follows-----
'From Squeak3.1alpha of 5 February 2001 [latest update: #3830] on 14 March 2001 at 6:46:03 am'!
"Change Set:		kbdTesting
Date:			14 March 2001
Author:			Bob Arning

Simple keyboard event reporting"!


!HandMorph methodsFor: 'event handling' stamp: 'RAA 3/14/2001 06:44'!
handleEvent: anEvent
	| evt ofs |
	owner ifNil:[^self].
	evt _ anEvent.

	EventStats ifNil:[EventStats _ IdentityDictionary new].
	EventStats at: #count put: (EventStats at: #count ifAbsent:[0]) + 1.
	EventStats at: evt type put: (EventStats at: evt type ifAbsent:[0]) + 1.

	evt isMouseOver ifTrue:[^self sendEvent: evt focus: self mouseFocus].

	evt isKeystroke ifTrue:[
		(String streamContents: [ :s | evt bobsPrintOn: s]),'                     ' displayAt: (0 at 20).
	].

ShowEvents == true ifTrue:[
	ofs _ (owner hands indexOf: self) - 1 * 60.
	evt printString displayAt: (0 at ofs) + (evt isKeyboard ifTrue:[0 at 30] ifFalse:[0 at 0]).
	self keyboardFocus printString displayAt: (0 at ofs)+(0 at 45).
].
	"Notify listeners"
	self sendListenEvent: evt to: self eventListeners.

	evt isKeyboard ifTrue:[
		self sendListenEvent: evt to: self keyboardListeners.
		self sendEvent: evt focus: self keyboardFocus.
		^self mouseOverHandler processMouseOver: lastMouseEvent].

	evt isDropEvent ifTrue:[
		self sendEvent: evt focus: nil.
		^self mouseOverHandler processMouseOver: lastMouseEvent].

	evt isMouse ifTrue:[
		self sendListenEvent: evt to: self mouseListeners.
		lastMouseEvent _ evt].

	"Check for pending drag or double click operations."
	mouseClickState ifNotNil:[
		(mouseClickState handleEvent: evt from: self) ifFalse:[
			"Possibly dispatched #click: or something and will not re-establish otherwise"
			^self mouseOverHandler processMouseOver: lastMouseEvent]].

	evt isMove ifTrue:[
		self position: evt position.
		self sendEvent: evt focus: self mouseFocus.
	] ifFalse:[
		"Issue a synthetic move event if we're not at the position of the event"
		(evt position = self position) ifFalse:[self moveToEvent: evt].
		"Drop submorphs on button events"
		(self hasSubmorphs) 
			ifTrue:[self dropMorphs: evt]
			ifFalse:[self sendEvent: evt focus: self mouseFocus].
	].
	ShowEvents == true ifTrue:[self mouseFocus printString displayAt: (0 at ofs) + (0 at 15)].
	self mouseOverHandler processMouseOver: lastMouseEvent.
! !


!KeyboardEvent methodsFor: 'printing' stamp: 'RAA 3/14/2001 06:06'!
bobsPrintOn: aStream

	aStream space.

	self commandKeyPressed ifTrue: [
		aStream nextPutAll: 'COMMAND '.
	].
	self controlKeyPressed ifTrue: [
		aStream nextPutAll: 'CONTROL '.
	].
	self shiftPressed ifTrue: [
		aStream nextPutAll: 'SHIFT '.
	].
	(keyValue between: 32 and: 126) ifTrue: [
		aStream nextPut: self keyCharacter; space.
	].
	aStream nextPutAll: (keyValue radix: 16).
! !






More information about the Squeak-dev mailing list