[Cuis-dev] Modal morph

Juan Vuletich JuanVuletich at zoho.com
Thu Mar 3 04:05:30 PST 2022

Hi Hilaire,

I can not give a quick and easy solution. This is complex stuff!

What I need is detailed instructions to build your exact setup. I guess 
it involves updated Cuis, and DrGeo. If those instructions are in the 
readme of DrGeo repo, that's even better.

Then, I'll need to play a bit with this and review the code. My gut 
feeling is that DropDownListMorph should not have any modal-specific 
code. That should be in the base framework. Having a concrete example to 
experiment with will help me find out the best way to do it.


On 3/3/2022 6:34 AM, Hilaire Fernandes via Cuis-dev wrote:
> 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

Juan Vuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220303/7aed3bd3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 12223 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20220303/7aed3bd3/attachment.png>

More information about the Cuis-dev mailing list