~eliasnaur/gio

1

Is it possible to programatically click a button

paulo melo
Details
Message ID
<5833F4A0-D792-4FE5-9B1E-E2032D611A42@gmail.com>
DKIM signature
pass
Download raw message
Hello Elias,

I’ve been trying to use gio, I am testing for wasm using a kind of a form.

I would like to depending on data set on the various fields programatically click a special button.

I’ve seen through your tests that I could do:

var r router.Router
r.Frame(ops
r.Queue(
  pointer.Event{
    Source:    pointer.Mouse,
    Buttons:   pointer.ButtonLeft,
    Type:       pointer.Press,
    Position:  center,
  },
  pointer.Event{
    Source:    pointer.Mouse,
    Buttons:   pointer.ButtonLeft,
    Type:       pointer.Release,
    Position:  center,    
  },
)


the problem is I don’t know how to get the center from the layout of the button. If I use layout.Dimension I only get the value of the button and not the frame

I believe It could be useful to set the click directly on the widget.Clickable

could you advise?

Best Regards,
Paulo Melo

Re: Is it possible to programatically click a button

Details
Message ID
<C8YAENU85M0Q.1M4NH0SFMRKFV@themachine>
In-Reply-To
<5833F4A0-D792-4FE5-9B1E-E2032D611A42@gmail.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Mon Feb 1, 2021 at 13:01, paulo melo wrote:
> Hello Elias,
>
> I’ve been trying to use gio, I am testing for wasm using a kind of a form.
>
> I would like to depending on data set on the various fields programatically click a special button.
>
> I’ve seen through your tests that I could do:
>
> var r router.Router
> r.Frame(ops
> r.Queue(
>   pointer.Event{
>     Source:    pointer.Mouse,
>     Buttons:   pointer.ButtonLeft,
>     Type:       pointer.Press,
>     Position:  center,
>   },
>   pointer.Event{
>     Source:    pointer.Mouse,
>     Buttons:   pointer.ButtonLeft,
>     Type:       pointer.Release,
>     Position:  center,    
>   },
> )
>
>
> the problem is I don’t know how to get the center from the layout of the button. If I use layout.Dimension I only get the value of the button and not the frame
>
> I believe It could be useful to set the click directly on the widget.Clickable
>

A Clickable.Click methods sounds good to me. There was a patch last
month[0] that wasn't finished, although it had a more complicated API
than I think is necessary.

Elias

[0] https://lists.sr.ht/~eliasnaur/gio-patches/patches/16075
Reply to thread Export thread (mbox)