Implement SelectableList GUI component#2053
Conversation
|
I am trying to do #1920 but I don't see a good way I can change something in my Element through you |
Possible. What do you mean by |
|
maybe something like a pointer to the parent GuiComponent. For the DropdownList it would be a pointer to the DropdownList so that I can set the selected Element. |
|
I called it |
|
I can simply add a user-defined argument to the callback, then you'll be able to set the value you need yourself. As it implemented in |
|
That sounds good. |
01dd2e4 to
614915e
Compare
|
Done. @Wunka, you can use it. |
|
See the pictures for reference: #2199 (comment) While implementing a example for my DropdownList I noticed a bug. While fixing that bug. I noticed that the Selectablelist is somehow making a hover over the checkbox under the list?? For testing I changed the color of the hover if it is realy the selectable list and it is. I also made a print for what it is making the rect and I also only got the thing I wanted. So I don't know where this bug comes from.. For my testing I changed onOpen of save_creation.zig to this: with a dummy method |
I don't know when but due to some commit this was fixed. I merged master into my dropdown example and now this weird hover doesn't exist anymore |
|
Sorry for the late reply, but so far I wasn't sure if we really want this. So it seems that overall this isn't actually needed for anything. Sorry for not figuring this out earlier, I know you probably put a lot of time into writing and then also rewriting this after my comment on the first attempt. |
This PR is a continuation of #2016 and adds the
SelectableListcomponent, which is implemented based on theVerticalList. The component allows the user to select any item in the list by clicking on it. This can also be done manually via code by calling the.select(<itemIdx>)and.deselect()methods. Relevant visual effects and keyboard navigation (using the up and down arrow keys) have been implemented.To handle the selection event in external code, there is a corresponding
SelectableCallback = *const fn(idx: usize) void, which passes the index of the selected item in the list.Hovered:

Selected:

You can test the component's functionality on the server-list-v2 branch by opening the "Join a Server" window in the main menu.
This is necessary to complete #2017 and will be useful for the future implementation of the drop-down menu #1920.