"Rek" wrote:
Sounds like maybe you want a stack of components instead of a hierarchy.
stacks FTW. Well, at least in theory. I haven't gotten that far. In "refactoring" / "making new code" mode.
Here's what I think I understand ( yes, I re-read that 3x to make sure I had it right ), Menu's and sub-menu's will be on one Stack, but their components ( buttons etc ) will be Lists ( one per Menu ).
Since I haven't yet gotten to the "Stack" phase of all this, I'm not sure how it'll work on screen. It might be a simple situation where I treat the "SuperMenu of Awesomeness" Stack as both a Stack and a List. The reason for both would be to make sure everything is drawn that needs to be -> "for each" -> [ List ] and to send user input to the active sub-menu -> .GetTail() -> [ Stack ] ... [ ifList also has .RemoveTail() ]
As for where I'm at right now, I'm still trying to find more descriptive names for things *and* where to put functionality. For example ( WARNING: this is not for the faint of heart. Sleep deprivation played a factor in this. Continue reading at your own risk
😞 I considered making onClick() -> onClickAndExit() that would return a Boolean if the component closed the current sub-menu. Thankfully, I came to a better / clearer solution which was to simply have a Boolean flag "exitOnClick" in the component and check that instead. It added a line of code in the event loop dag-nab it! But it is much clearer. [ of course, now that I've typed all this out, I start to re-consider and think "exitAfterClick" or "closeDialogAfterClick" would be better names! ]
I also have some Q's about "global" vars or accessing variables of different objects from within a menu, but I'll save them for later.
The further I go down this rabbit hole, the more I wish I'd just use the built in SDK UI elements and bend them to my will.
😉 peace, good night now & 42