[ENH] Re: double-click for system window

Simon Michael simon at joyful.com
Tue Dec 9 17:00:10 UTC 2003

And here's the hack itself in case you want to try it, as an ENH, what 
the heck. I assume it works better on fast systems.

Simon Michael wrote:
> This weekend I tried to implement something I've wanted for a long time, 
> double-click to collapse and expand system windows. Anybody done this 
> already ?
> I got it basically working and then found DoubleClickExample (thanks for 
> that). I find it increases usability quite a bit.
> What I'm doing right now is calling waitForClickThingy in 
> SystemWindow>>mouseDown:, then doubleClick: does collapseOrExpand.
> I don't activate the window in mouseDown: any more, instead this happens 
> in click:, startDrag:, or in doubleClick: if we are expanding.
> Problem: on my slow P266, calling activate in click: tends to prevent 
> the following click from being recognized as a doubleClick:. Curiously 
> this happens about 10% of the time in my latest bells-and-whistles image 
> but about 90% of the time in an earlier cleaner version. If I remove the 
> activate from click:, double-click always works.
> Squeak tends to lose events on this system, but in this case I'm 
> guessing the cause is simple: activate is slow and delays the second 
> click until after the double-click interval has passed. I'd try 
> increasing it just to test this but can't remember how. Also I can't 
> explain the difference on the clean image.
> Any ideas or suggestions ?
-------------- next part --------------
'From Squeak3.7alpha of ''11 September 2003'' [latest update: #5595] on 9 December 2003 at 8:41:46 am'!

!SystemWindow methodsFor: 'events' stamp: 'sm 12/9/2003 08:41'!
click: evt 
	self activate
	"hmm.. this is always called before doubleClick: and on slow systems, activate may exceed the DoubleClickTime and prevent the double-click being recognized as such"! !

!SystemWindow methodsFor: 'events' stamp: 'sm 12/7/2003 16:15'!
doubleClick: evt 
	"Transcript show: 'SystemWindow doubleClick: ';
		 show: evt;
	self collapseOrExpand.
	self isCollapsed
		ifTrue: [self sendToBack]! !

!SystemWindow methodsFor: 'events' stamp: 'sm 12/7/2003 16:15'!
mouseDown: evt 
	"Transcript show: 'SystemWindow mouseDown: ';
		 show: evt;
	self setProperty: #clickPoint toValue: evt cursorPoint.
	"sm: also listen for a double click  
	TopWindow == self  
	ifFalse: [evt hand releaseKeyboardFocus. (need this part ?)  
	self activate]."
	evt hand waitForClicksOrDrag: self event: evt.
	model windowActiveOnFirstClick
		ifTrue: ["Normally window keeps control of first click.  
			Need explicit transmission for first-click activity."
				do: [:m | (m containsPoint: evt cursorPoint)
						ifTrue: [m mouseDown: evt]]]! !

!SystemWindow methodsFor: 'events' stamp: 'sm 12/7/2003 16:15'!
startDrag: evt 
	"Transcript show: 'SystemWindow startDrag: ';
		 show: evt;
	self activate! !

More information about the Squeak-dev mailing list