[Cuis-dev] [IMPROV] Should have been: Menu(Item) duplication

Gerald Klix cuis.01 at klix.ch
Wed Aug 31 14:03:43 PDT 2022


Hi Hernán,

I presume the issues is caused by the menu morph having
the mouse focus.
If you look at HandMorph>>#startMouseDispatch:
the mouse event is sent to the morph having the mouse
focus with #handleFocusEvent:.

I suppose proper dispatching fails,
because the halo is not in the menu morph's
owner chain.

If I change MenuMorph>>#addHalo:

to

addHalo: evt
	self stayUp.
	evt hand newMouseFocus: prevMouseFocus.
	super addHalo: evt

everything works as expected.

I don't know the proper solution,
probably it makes sense to make the
newly created halo grab the mouse focus.

Anyways changing popUpFor:handPosition:hand: to

popUpFor: aMorph handPosition: handPosition hand: hand

	hand halo: self.
	hand world addMorphFront: self.
	self target: aMorph.
	positionOffset _ handPosition - aMorph morphPositionInWorld.
	hand newMouseFocus: self

works as well, even with MenuMorphs old #addHalo:
implementation.

Personally I like the later solution a bit more,
because it resembles the pop-up code in menus.
I think popup morphs like menus and halos
should grab the mouse focus.


HTH,

Gerald



On 31.08.22 22:26, Gerald Klix via Cuis-dev wrote:
> Hi Hernán,
> 
> I can confirm this behavior for every halo button,
> not only the duplicate button. I was under the impression,
> that the halo's move button does not work, while the Pick-Up-button 
> does. But this finding is wrong. I can confirm that every menu's
> halo button only works on the second click. It does not matter
> in which way a menu was created.
> 
> I suppose this behavior is unrelated to my simple duplication hack.
> 
> 
> HTH,
> 
> Gerald
> 
> 
> On 31.08.22 21:29, Hernán Wilkinson wrote:
>> Hi Gerald,
>>   I think it makes complete sense what you send because we lost that
>> possibility when using submenues.
>>   I've tested it and it works, but there is something that bothers me. 
>> When
>> I press the "duplicate" halo, I have to press it twice for it to really
>> duplicate the menu, do you know why? The same thing when pressing the
>> closing halo... I do not think it has to do with what you did, does the
>> same happen to you?
>>
>> Cheers!
>> Hernan.
>>
>> On Thu, Aug 25, 2022 at 5:45 PM Gerald Klix via Cuis-dev <
>> cuis-dev at lists.cuis.st> wrote:
>>
>>> Sorry, forgot a decent subject line.
>>>
>>> On 25.08.22 22:35, Gerald Klix via Cuis-dev wrote:
>>>> Hi all, Hi Juan,
>>>>
>>>> I miss the possibility to pin the “Open” and “Window” menus.
>>>> Therefore I created a patch that adds
>>>> a handler to `MenuItem` for mouse “button 2 up” events
>>>> that duplicates either the menu item or -- if
>>>> available -- the sub menu.
>>>>
>>>>
>>>> HTH and Best Regards,
>>>>
>>>> Gerald
>>>>
>>>
>>> -- 
>>> Cuis-dev mailing list
>>> Cuis-dev at lists.cuis.st
>>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>>
>>
>>
> 



More information about the Cuis-dev mailing list