Morphic: registering for doubleClick events on tite prevents window from being dragged? (Skylark theme)

Matthias Berth matthias.berth at googlemail.com
Sun Apr 22 14:30:49 UTC 2007


Hello,

I thought I would implement the "double click on a window title to
close it" behavior. I use the skylark 2 theme from
http://www.comtalk.net/Squeak/87 on Squeak 3.9.

Skylark  adds a label area to the window where it puts buttons for
closing the window etc. Inside that method I added code to listen for
double click events:

SystemWindow>>initializeLabelArea
	"Initialize the label area (titlebar) for the window."

       .....

	"Make windows collapse and expand by double clicking on
	their title"
	labelArea
		on: #doubleClick
		send: #collapseOrExpand
		to: self.


Now I noticed that double clicking works, but I can no longer move the
window by dragging the title. What's going on? I am pretty
unexperienced in Morphic, so maye I am missing something basic here?


Cheers

Matthias

PS: Here is the whole method

initializeLabelArea
	"Initialize the label area (titlebar) for the window."
	label := StringMorph new contents: labelString;
				
				font: Preferences windowTitleFont
				emphasis: (Preferences windowTitleFont isTTCFont
						ifTrue: [0]
						ifFalse: [1]).
	"Add collapse box so #labelHeight will work"
	collapseBox := self createCollapseBox.
	self useTheme
		ifFalse: [stripes := Array
						with: (RectangleMorph newBounds: bounds)
						with: (RectangleMorph newBounds: bounds)].
	"see extent:"
	self addLabelArea.
	self useTheme
		ifFalse: [labelArea
				addMorph: (stripes first borderWidth: 1).
			labelArea
				addMorph: (stripes second borderWidth: 2)].
	self setLabelWidgetAllowance.
	self addCloseBox.
	self addMenuControl.
	labelArea addMorph: label.
	self wantsExpandBox
		ifTrue: [self addExpandBox].
	labelArea addMorph: collapseBox.
	self setFramesForLabelArea.
	"Make windows collapse and expand by double clicking on
	their title"
	labelArea
		on: #doubleClick
		send: #collapseOrExpand
		to: self.
	Preferences clickOnLabelToEdit
		ifTrue: [label
				on: #mouseDown
				send: #relabel
				to: self].
	Preferences noviceMode
		ifTrue: [closeBox
				ifNotNil: [closeBox setBalloonText: 'close window' translated].
			menuBox
				ifNotNil: [menuBox setBalloonText: 'window menu' translated].
			collapseBox
				ifNotNil: [collapseBox setBalloonText: 'collapse/expand window' translated]]



More information about the Squeak-dev mailing list