[ANN][GOODIE] keyboard-focus packages on SM

Hernan Tylim htylim at yahoo.com.ar
Mon Nov 17 18:56:51 UTC 2003


Hi,
	A couple of weeks ago I had on the list a couple of mails about how to make
the keyboard focus logic in Squeak act like the TAB and mouse-click style.

	Well, my ramblings have ended and I wanted to tell you that I made
available on SM these 2 packages:
	1. click for keyboard focus
	2. keyboard focus rotation.

	The first one modifies the existing preference #mouseOverForKeyboardFocus
so when it's disabled it will meant 'mouse down for keyboard focus'. Without
this .cs when the preference is false a TextMorph won't release
keyboard-focus upon mouseLeave. But because it get it upon mouseEnter it
isn't very diferent than when the preference value is true.

	With this .cs a mouseDown is required to change the keyboard focus holder
on Morphs, PluggableTextMorph and PluggableListMorph. Also I added a couple
of features to PluggableTextMorph:

	PluggableTextMorph>>autoAcceptOnFocusLoss: trueOrFalse   and
	PluggableTextMorph>>showSelectionOnlyOnKeyboardFocus: trueOrFalse

	By default, both PluggableTextMorphs properties are set to false (the
current semantic). The showSelectionOnlyOnKeyboardFocus was added because it
was weird for me to see pluggableTextMorphs with cursors or showing
selections without keyboard focus.

	NOTE: This change set has the following side efect. After Installing, to
make a morph inside a pasive SystemWindow get keyboard focus it will require
2 clicks. One to activate the system window, and one to pass the keyboard
focus to the submorph.

	The second change-set what it does is make possible to switch keyboard
focus via simple keystrokes. Note that this .cs does not make existing
browsers TAB-switching-keyboard-focus aware. It will only provide some hooks
on system classes to use it. (See KeyboardFocusChain class comment)

	As a silly demo do the following:
	- install both changesets[*].
	- open a browser
	- inspect the SystemWindow and evaluate the following inside the inspector:

		self addToKeyboardFocusChain: KeyboardFocusChain new.

	- Now, click (2 times) on a list on the browser
	- Finally, hit TAB, and hit TAB, and hit TAB, and ...

	[*] It isn't really necesary to install the first changeset (click for
keyboard focus), so if you don't you have to be careful to don't touch the
mouse when hitting tab or the morph below the mouse will steal the keyboard
focus.


Hope this might be useful to someone.
Thanks for your help!

Regards,
Hernan




More information about the Squeak-dev mailing list