Closed focustense closed 3 weeks 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.
I forgot to link it to the bug, but I think commit 62caf3d basically takes care of this in the simplest way possible. Since the game itself is not very consistent about tabs vs. pages, I'd rather not push that model onto users either; instead, they can handle whatever buttons they like at whatever level like they like.
Library-based UI has access to the
ITabbable
andIPageable
interfaces, the idea being that aWrapperView
(nowComponentView
) 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:
*tabbable
that allows new event handlersnext-tab=|...|
andprevious-tab=|...|
to be defined. I'm not sure if this could actually be implemented in any way similar to normal events or whether or would just be a pile of hacks that pretends to act like a normal event.*next-tab={NextTab}
etc., which is even more iffy in terms of implementation, though I guess ifNextTab
were anAction
property as opposed to an actual method then it would be OK.*tab={TabIndex}
or*page={PageIndex}
where the node increments/decrements the value; this is the most convenient for the framework but the view model has to do all the validation and possibly conversion fromint
to some other thing.<include>
, e.g.<tabbable>
or<pageable>
with their own virtual events.Tabbable
orPageable
views that have real events and real tags, and act somewhat like frames (though this means they also need to have layout, context, etc.)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.