[Newbies] Losing focus

Ralph Boland rpboland at gmail.com
Wed Oct 25 03:57:59 UTC 2017

I created a button class which is  version of IconicButton
(by cutting and pasting) that does extra things that I need.
One of the things that I do is expand the size of my button
(actually a collection of my buttons) when running an application that uses it.
When I do so only a small area of near the top left corner of my
button seems to have focus
so then if I click on that area the button works but otherwise it does not.

When I click within my botton's working area  <MyButton>>handleEvent:
anEvent> is called by
<MouseOverHandler>>processMouseOver: anEvent>.

When my button does not work the method <handleEvent: anEvent>  is not called
because, I believe, the portion of my button that was clicked  does
not have focus.
Note that when my button size is expanded it's position is also changed because
other morphs have also expanded but this expansion does not seems to
cause confusion
as to where the button is because the working focus area
remains in the same part of my button.
But there appears to be confusion as to the size of my button and its
focus area.

Debugging this is a pain.  When I set a break point in
<MyButton>>handleEvent: anEvent>
the emergency handler pops up.  when I do a <revert>  I get my stack with
<MyButton>>handleEvent: anEvent>  at the top of the stack.
But I have gathered little useful information by looking at this stack.
The only solution I can think of is to discard by button (buttons)
and reinstantiate them every time they need to be resized.

Is there something that I should be setting when I resize my button so
that it's focus area
is correct?

Is discarding my buttons and reinsantiating them the only solution?

Any help or insight appreciated.

Ralph Boland

More information about the Beginners mailing list