<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font size="4">Hi, <br>
</font></p>
<p><font size="4">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).<br>
</font></p>
<p><font size="4">So to pop up my drop down list of morph, I have
this method:<br>
</font></p>
<pre><font size="4">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
</font></pre>
<p><br>
</p>
<p>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:</p>
<img moz-do-not-send="false"
src="cid:part1.u5HGiBrz.akfGfLN0@drgeo.eu" alt="" width="202"
height="217">
<p><br>
</p>
<p>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.<br>
</p>
<p>The related mouse button up event is handled as:<br>
</p>
<pre>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
</pre>
<p>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.<br>
</p>
<p>Ideas?</p>
<p>Hilaire<br>
</p>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a class="moz-txt-link-freetext" href="http://drgeo.eu">http://drgeo.eu</a>
<a class="moz-txt-link-freetext" href="http://blog.drgeo.eu">http://blog.drgeo.eu</a></pre>
</body>
</html>