I'm quite new to Gio, and probably in over my head. I hope this is an
easy question: How does one disable a button so it doesn't respond to
a pointer press?
In searching this list, I found this from 3 years ago:
------------------
In Gio, the disabled state is represented by a nil Queue by convention.
So, do something like:
if disabled {
gtx.Queue = nil
}
----------------
I'm not sure if that's what I want, but even if it is, I don't see a
member of gtx (layout.Context) named Queue. Am I missing it?
Of course, I can just ignore a pointer press, and I can draw the
button in "grayed out" colors. But there is still the little animated
reaction to the button press.
FYI, this is how I create the button:
var btnAdd widget.Clickable
layout.N.Layout(gtx, func(gtx C) D {
gtx.Constraints.Max.Y = gtx.Dp(unit.Dp(80))
return layout.Flex{Axis: layout.Horizontal}.Layout(gtx,
layout.Rigid(func(gtx C) D {
b := material.Button(pnl.th, &btnAdd, "")
b.Color = clrWhite
b.Background = clrDkGray
b.Text = "ADD"
return b.Layout(gtx)
}),
)
Thank you for any assistance!
Hi Paul!
> I'm quite new to Gio, and probably in over my head. I hope this is an
> easy question: How does one disable a button so it doesn't respond to
> a pointer press?
>
> In searching this list, I found this from 3 years ago:
>
> ------------------
> In Gio, the disabled state is represented by a nil Queue by convention.
> So, do something like:
>
> if disabled {
> gtx.Queue = nil
> }
> ----------------
The field has been renamed "Source", but you can disable it easily with:
gtx = gtx.Disabled()
Sorry for the confusion, but hopefully it's easy from here.
Cheers,
Chris