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

Juan Vuletich juan at cuis.st
Wed Sep 7 06:11:32 PDT 2022


Hi Gerald,

Thanks for all this!

I just integrated your menu duplication, and your second solution to the 
focus problem. Your code also made apparent an unrelated bug in morph 
duplication (some garbage was left on the screen), that I just fixed.

Cheers,

On 8/31/2022 6:03 PM, Gerald Klix via Cuis-dev wrote:
> 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


-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich



More information about the Cuis-dev mailing list