[Cuis-dev] CheckButtonMoprh and fillColor

Mark Volkmann r.mark.volkmann at gmail.com
Sun Aug 11 14:24:58 PDT 2024


On Sun, Aug 11, 2024 at 3:57 PM <ken.dickey at whidbey.com> wrote:

> On 2024-08-11 12:54, Mark Volkmann via Cuis-dev wrote:
>
> > I'm struggling to understand the use of fillColor in CheckButtonMorph
> > after studying the code for an hour. For example:
> >
> > cb := CheckButtonMorph new.
> > cb fillColor: Color white.
> > cb openInWorld.
> >
> > This will display a checkbox with a black, rounded border filled with
> > white.
> > If you hover over it, the fill color will change to gray.
> > I see where that happens in the code. It is the border color with 50%
> > opacity.
> >
> > If you move the mouse outside the checkbox, it will change to be filled
> > with black.
> > Is this intended? I'm trying to find a way to get it to return to the
> > fill color I specified which is white.
>
> Looking at the code, I see that fillColor is transitory -- it changes
> with the state of the CheckButtonMorph.
>
> Perhaps try:
>
> Feature require: 'UI-MetaProperties'.
> CheckButtonMorph example1 openInWorld.
>
> Use the "Change Scale" construction handle to make it bigger.
> Then open the checkButtonMorph's menu and click the pushpin.
> As you move the mouse in and out over the checkButton and click it to
> change its state, you will see the fillColor change.
> Use the menu to change the #color and #borderColor to get what you want
> (e.g. color yellow, borderColor lime green).
> Play with it a bit more to see how the checkButton is expected to work
> with mouseover & mouseup/click.
>

That was helpful!
I see now that by default:
- It is initially filled with the border color and that represents being
unchecked.
- Hovering over it changes the fill to be the border color with 50% opacity.
- Clicking it causes the fill to change to the value of the color instance
variable (defaults to white) and display a checkmark that is always black.
- There is no point in setting the fillColor instance variable because it
will just get changed as soon as you hover over the morph.

I think I want something that behaves more like a browser checkbox or
like the checkboxes in the morph menu items "resist being picked up" and
"be locked".
Just an opinion, but having a checkbox that is filled when not checked
might make some users think it is checked.

-- 
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240811/56cc41b1/attachment-0001.htm>


More information about the Cuis-dev mailing list