2

I have a container with columns, in each column a different container. Now I want to click on a container (column item) and do something with that container.

Is it possible to create a click (tap) event on a container?

Or (which I like to avoid if possible) do I have the make a custom widget from this container?

1 Answer 1

1

You can add a tap handler to any widget through extension (see https://developer.fyne.io/tutorial/extending-widgets). Your custom widget would embed an existing one and just add the Tapped method to enhance it. This avoids making a completely custom widget.

This is the design of Fyne - enhancement through extension instead of every widget implementing every possible combination of events.

2
  • Hi Andy, yes that I understand, but is it possible to add a Tapped method to a container?
    – Mick dK
    Apr 1, 2021 at 10:29
  • 1
    Oh I see, sorry. No - containers are not widgets and just designed to arrange children. This is in-part becuase we believe that there should be user indication of interaction, and a container does not have such ability either. You'll need to make a trivial widget if you want to add interaction to a collection of elements.
    – andy.xyz
    Apr 2, 2021 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.