toga icon indicating copy to clipboard operation
toga copied to clipboard

Add ability to create context menus for Widget

Open hyuri opened this issue 1 year ago • 3 comments

What is the problem or limitation you are having?

Currently, Toga seems to provide no way for us to create context menus and associate them with certain widgets. This limits the potential to develop some more complex applications that might benefit from them — apps containing multiple panels that can be placed in different sides of the GUI, as an example, like image editors.

Describe the solution you'd like

Add ability to create context menus and assign them to certain widgets, like Boxes. It's especially useful because, since Toga doesn't provide drag and drop support yet, context menus can provide a way to add options such as "Move panel to the right/left" etc.

Describe alternatives you've considered

None

Additional context

No response

hyuri avatar Oct 09 '24 21:10 hyuri

A reasonable request for desktop platforms; possibly with some internal overlap with #2210 (in that there's now a "scope" in which some commands are visible/available)

Some thought will need to be given to how this will manifest on mobile. There isn't really any analog of context menus on mobile; we need to be careful that we don't encourage a UX design pattern that could lead to commands being hidden from use.

The ultimate answer might end up be a straightforward "context menus are ignored on mobile"; but that needs to be a conscious decision, not an accidental one.

freakboy3742 avatar Oct 09 '24 21:10 freakboy3742

It's not uncommon for mobile apps to use things at least conceptually similar to desktop context menus, usually accessed via long press. For instance, long press on a text in Apple Messages:

EB4A3DD3-634D-4D47-B4E3-634A5400F58A_1_201_a

Granted, while the bottom part is basically a standard desktop context menu, there's also the considerably more freeform, fancifully styled thought bubble full of emoji above. I have no idea how one would map such a thing to a general-purpose context menu API... unless it had an option to create/show arbitrary widgets, I suppose.

HalfWhitt avatar Nov 26 '24 04:11 HalfWhitt

It would be really nice to have this

laike9m avatar Sep 12 '25 06:09 laike9m