-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create autoscroll for listbox #318
Comments
Hi. It's not clear what you're asking for... Looking at your video, you are clearly updating the options of a ListBox (to add a new line). When you do that, asciimatics will try to find the existing selection in the new list of options and scroll to make that visible, which is what appears to be happening here. Can you explain what you want to change? |
Ok, I'll try explain my idea by code, because my eng not good. if ListBox.value == ListBox.options[-1][1]:
ListBox.options = new_options
ListBox.value = new_options[-1][1] # scroll to bottom of listbox
else:
ListBox.options = new_options |
Ok! Got it. Thanks. It seems to me that this code is easy to write if anyone needs it, so I'm not sure it warrants adding to the base package. Looking at equivalent GUI systems, it's pretty common that you have to write something similar to that. For example, see https://www.csharp-examples.net/autoscroll/ But maybe it would be easier to write if the selected index was exposed as a property? |
May create a flag that will execute such code ListBox.autoscroll = True or ListBox.set_autoscroll(True) |
Listbox autoscrolling if scrollbar is at the bottom.
Example:
https://user-images.githubusercontent.com/60063501/120595827-aa149900-c44b-11eb-9b66-c90f57678208.mp4
The text was updated successfully, but these errors were encountered: