focustense / StardewUI

UI/widget library for Stardew modding
MIT License
5 stars 1 forks source link

Tabbable/Pageable support in Framework #29

Open focustense opened 1 day ago

focustense commented 1 day ago

Library-based UI has access to the ITabbable and IPageable interfaces, the idea being that a WrapperView (now ComponentView) can implement these interfaces to hook the shoulder and trigger buttons for these functions.

This isn't available in StarML and it seems I just plumb forgot about it.

These interfaces are simple enough to carry over Pintail, but unfortunately I don't think it will work that way because they're not actually involved in the API call; if a client defines its own ITabbable and applies it to some view model, it's not going to be recognized as "the" ITabbable except with some duck typing (#21) and/or name-matching and signature comparisons.

Some other options I'm thinking of, with varying degrees of ugliness:

I'm not wild about any of these, but there's probably some iteration or mutation of one of them that will turn out to be relatively clean.

focustense commented 1 day ago

The more I think about this, the more I wonder if it's useful at all, vs. just defining a common button press event and letting models handle the appropriate buttons.

Tabbable and pageable really aren't strictly defined and vanilla menus like the Carpenter build menu use shoulder buttons for "pages" rather than "tabs". And controls really need to be able to handle button events anyway. The only downside is that it's easier to forget to add those button handlers vs. having something like a <tabbable>. Still, given the complexity and fiddliness of a one-size-fits-all solution, that might very well be a fair tradeoff.