Open Nonoreve opened 7 months ago
The way it's currently implemented in DPG, every widget requires its own implementation of "set/get scroll" functions. Nobody has ever implemented it for listboxes.
I have a fix that might eventually get into the community repo, which improves implementation of the scroll functions and, among other things, should make it easy to enable them on listboxes. This fix has to wait some other PRs to be merged first, so it's not going to happen in near future.
In the meantime, you can implement your own listbox by placing selectable
's into a child_window
. It's pretty easy to do, and you can control scrolling like on a regular child window.
Also take a look at this implementation and other files in that folder - maybe you can just use them as is. https://github.com/my1e5/dpg-examples/blob/main/listbox/listbox_custom.py
Version of Dear PyGui
Version: 1.9.1 Operating System: Manjaro (in virtual env)
My Issue/Question
I want to a listbox to focus a particular line. But using set_y_scroll() gives the message :
Incompatible type. Expected types include: mvWindowAppItem, mvChildWindow
The listbox does indeed have a scrollbar, what prevents it from being scrolled programmatically ? Is there an other way to do it ?To Reproduce
Run code below Click on the button
Expected behavior
The scrollbar should move to the desired position.
Standalone, minimal, complete and verifiable example