Open myg3nx opened 3 years ago
Thank you! I am glad you like it.
Listbox was created as simple as possible. As horizontal scroll is considered inconvenient even in GUI, I did not implement it in TUI. As of TextView, it has a feature that simplifies the code a lot: both scrollbars are always visible. I do not think it works good for Listbox. Ideally, Listbox horizontal scroll should be automatically hidden if its width is sufficient, or a horizontal scroll should be enabled manually. Though, it makes drawing function more complex.
To add horizontal scrollbar to a Listbox here is the list of tasks:
leftShift
to support horizontal scrollingprocessMouseClick
to catch scrollbar clicks. Do not forget about: 1) vertical scrollbar is shorter when horizontal one is disaplyed 2) it makes right-bottom corner do nothing on clickDraw
and its children to support: 1) drawing correctly all items 2) draw horizontal scrollbarAnother and easier way (if you do not care much about mouse support): do not draw horizontal scrollbar at all. Just add two hotkeys to shift the content left/right. And fix DrawItems
so it displayed a special mark in the beginning of every item marking that the items is displayed not from the first character. E.g, a file manager FAR uses this way - it displays '{' on a file listbox border instead of '|' to indicate that the file name in this line is not displayed from its first character.
hi, thanks for answer my question... the explanation is clear for me. i will try it to get this work.. :)
You are welcome!
At this moment I do not have go
compiler on my home machine(as I removed old version due to incompatibilities with another software), so I cannot debug improve the library. But feel free to open PR :)
hi, thanks for your project, i realy like it so much... i have one question that how to enable horizontal scrolbar for long text item in listbox? if you dont mind, please add this fiture. thx (i had take a look your code at "textview.go", it has scrolbar, but i dont know how to implement this to listbox)