[Cuis-dev] Modal morph

Hilaire Fernandes hilaire at drgeo.eu
Thu Mar 3 01:34:58 PST 2022


Hi,

A few weeks ago I posted about how to make a DropDownListMorph modal. I 
fixed the issue by borrowing the code from popup menu (it is modal 
behavior).

So to pop up my drop down list of morph, I have this method:

PluggableDropDownListOfMorph>>popUpAt: position forHand: hand in: aWorld 
     aWorld addMorphFront: self position: position.     self fitInWorld. 
     prevKbdFocus _ hand keyboardFocus.     prevMouseFocus _ hand 
mouseFocus.     hand newMouseFocus: self;         newKeyboardFocus: self


The modal behavior is perfectly achieved. However, the scroll morph in 
the list morph does not receive event anymore (but it is part of the . 
Observe on the screenshot below, the scrollbar is not highlight how it 
should be:


When I click on the scroll bar, the event is directed to the list of 
morphs (colored boxes), of course it produces an error as it does not 
match with any morph of the list (colored boxes). So I edit a bit the 
method below to handle the mouse up button event. Now It makes the 
scrollbar slider and buttons inoperable by the user, only it can be 
controlled with the mouse scrolling wheel button.

The related mouse button up event is handled as:

mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition
	"Handle a mouse up event."
	(self includesPixel: aMouseButtonEvent eventPosition)
		ifFalse: [
			self deleteIfPopUp: aMouseButtonEvent.
			self activeHand
				newKeyboardFocus: prevKbdFocus;
				newMouseFocus: prevMouseFocus.
			^ self ].
	"No click outside, handle normally"
	(scrollBar 	includesPixel: aMouseButtonEvent eventPosition)
		ifTrue: [scrollBar mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition]
		ifFalse: [super mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition].
	aMouseButtonEvent hand newMouseFocus: self

A workable solution is to override mouseButtonXUp: methods to set back 
the focus and to dispatch manualy the mouse event to the scrollbar. It 
is a bit overkill. I don't know how to handle the situation more properly.

Ideas?

Hilaire

-- 
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220303/58bf62fa/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FocusAndNoFocus.png
Type: image/png
Size: 12223 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220303/58bf62fa/attachment-0001.png>


More information about the Cuis-dev mailing list