[squeak-dev] problem with MenuMorph like morphs

karl ramberg karlramberg at gmail.com
Fri Mar 27 16:44:24 UTC 2020


Hi,
Can you post a link to the code?

Cheers,
Karl

On Fri, Mar 27, 2020 at 5:33 AM Ralph Boland <rpboland at gmail.com> wrote:

> I have a Morph subclass, say M, that contains a collection of
> "ItemMorph", say, as submorphs.
> When an M is displayed the ItemMorph submorphs are displayed in a
> column.  An ItemMorph
> can act as a display of data but can also act as a button.  This code
> all works as expected.
>
> I sometimes need an M morph to act similar to a MenuMorph;  that is
> the  M  morph
> can be made to display on command, say from pressing some button.  Then
> once the
> user presses on one of the M morph submorphs (ItemMorphs)  the pressed upon
> submorph is to like a button invoking some action.   Once the
> selection is made the
> entire  M  morph is to be deleted from the screen, like for a MenuMorph.
>
> Except in my case the button action never occurs and the M morph is not
> deleted.
>
> To get to the root of the problem I made copies of Classes  MenuMorph
> and MenuItemMorph
> and was able to get menus to work using these classes. Once I got
> these copied morphs to
> work like regular menus I was able to set breakpoints without getting
> unwanted call stacks.
>
> I then made the changes to  M and  "ItemMorph" based upon what I
> learned about MenuMorph
> and MenuItemMorph.   I then made a call stack occur when using the
> copied Morphs by having the
> method to invoke when a selection is made not exist.  My classes  M
> and ItemMorph have
> every  method that is a mehod of  MenuMorph or  MenuItemMorph on the
> call stack.  But none
> of them are called when I try to create a menu using M.
>
> It seems that some code that handles focus invokes a new process to
> handle the click by
> the mouse on a MenuItemMorph  but doesn't do so or does so such that
> nothing happens
> when I click on a ItemMorph submorph of an  M morph on my screen.
>
> Where can I set a breakpoint so that I can investigate why nothing
> happens when I click
> on a ItemMorph instance submorph of an M morph on the screen?
>
> Notes:
> 1) When my M morph is first displayed there is at the top a balloon that
> says:
>
>                    Enter text to narrow selection
>                    down to matching items
>
> I didn't intend for this balloon to occur but it got picked up somehow.
> It would be useful to know how to change its text or remove it.  I
> point it out here only because
> it may help explain what is happening.
>
> 2)  On mouseUp this balloon disappears.
>
> 3) after the second mouseDown the  M morph gains a shadow and can be
> picked up and moved.
>
> This is an open source project for teaching math/science to young kids.
> I have problems with the MIT license though so not sure what license I
> will use.
>
> Any help much appreciated and sorry about the post length.
>
> Ralph Boland
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200327/ac2eb250/attachment.html>


More information about the Squeak-dev mailing list