Skip to content
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

CheckBoxList with Horizontal ScrollBar #485

Closed
rednoah opened this issue May 28, 2020 · 11 comments
Closed

CheckBoxList with Horizontal ScrollBar #485

rednoah opened this issue May 28, 2020 · 11 comments

Comments

@rednoah
Copy link
Contributor

rednoah commented May 28, 2020

Does CheckBoxList support Horizontal Scrollbar? I can't seem to figure out how to make a List that can scroll both vertically and horizontally.

@AObuchow
Copy link
Contributor

I've also run into this issue!

If this feature doesn't exist, I could hopefully provide a patch for it (although I might need a bit of guidance).

@rednoah
Copy link
Contributor Author

rednoah commented May 28, 2020

@avl42
Copy link
Contributor

avl42 commented May 28, 2020 via email

@AObuchow
Copy link
Contributor

AObuchow commented May 28, 2020

@avl42 correct :)

In my case, the labels in the checkbox are file paths, which can be of variable length, and the checkbox has its own window (I implemented a checkboxListDialog, which I plan to submit upstream eventually :))

As a result, an exception would be thrown if the labels were so long that the checkbox list's window would expand past the size of the terminal (or something similar, I can give the exact stack tracer tonight).

The workaround was to limit the size of the checkboxListDialog's window, however, this means that certain labels aren't fully-readable as they exceed the maximum-visible length.

I'm not sure if this is a good enough use case to require horizontal scrollbars though, maybe there's a workaround?

@rednoah what's your use case? I'm curious if you're facing a similar issue.

@rednoah
Copy link
Contributor Author

rednoah commented May 28, 2020

Essentially the same use case as @AObuchow I suppose. File paths. Not generally a problem, but some users do have crazy long file paths for some reason, and then CheckBoxList will just cut things off. Oddly enough, the "Terminal is too small. Use ALT+LEFT/RIGHT to scroll." behaviour doesn't kick in either.

e.g.
image

@avl42
Copy link
Contributor

avl42 commented May 28, 2020 via email

@AObuchow
Copy link
Contributor

I'm tempted to think of "good ol' norton commander" or midnight commander on unix. You have panels of files, and if filenames are too long, they are shortened with maybe the begin, the end, or some middle part being replaced by "...".

I'm actually making a type of Norton Commander clone, and have this implemented with a ListItemRenderer :D

Even if the user needs to be able to see the full 256 chars or longer filename, I'd probably instead let the labels themselves scroll (with cursor right/left), while leaving the "[ ]" checkboxes fixed against horizontal scrolling. Unfortunately, however, if you need it, you need to implement it yourself, as of Lanterna's current state.

Okay I'll go with this approach. I assume there's no way to do this with a ListItemRenderer correct? I'd have to override the labels of the checkbox (if that's possible?).

@rednoah
Copy link
Contributor Author

rednoah commented May 29, 2020

I've looked into Table which does seem to implement vertical scroll, but at least in my test case vertical scrolling didn't work, rows are just cut off, with no scrollbars or sideway scrolling. I'll look into it again some other time.

@mabe02
Copy link
Owner

mabe02 commented May 31, 2020

@AObuchow yes, unfortunately there is no native support for horizontal scrolling of list item labels. There is a ScrollBar component you can use, but you'll have to implement your own renderer (with scrolling state) for the listbox and then hook that up to the scrollbar.

@AObuchow
Copy link
Contributor

@mabe02 that's fine with me :) I'll use the approach you described and let you know how it goes.

@rednoah
Copy link
Contributor Author

rednoah commented Jun 17, 2020

Closing this issue in favour of the generic ScrollPanel feature request:
#490

@rednoah rednoah closed this as completed Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants