gyscos / gyscos/cursive

Always showing scrollbar in nested view?

Open
#463 16 comments 0 reactions 0 assignees View on GitHub
views
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

First: is this a bug report? A suggestion? Or asking for help?

Asking for help.

# Problem description

I've trying to create a spreadsheet-like custom `View`. it consists of a vertical `LinearLayout` with two `Canvas` child views: a fixed-height column header, and a variable-height records body, both of which have the same width. I'm looking to add scrolling to this view, in the following way:

1) The header should scroll horizontally along with the records, similar to how the column labels horizontally scroll along with content in Excel/Calc.
2) Only the records `Canvas` should scroll vertically. The idea is that the header should always be visible, even if scrolled all the way to the bottom of a long list of records.
3) The vertical scrollbar on the records `Canvas` should always be visible if there are enough records to need a vertical scrollbar.

As of right now, I create/configure the header `Canvas`, create/configure the records `Canvas` (including making it scrollable: `.scrollable().scroll_x(false).scroll_y(true)`), add them both as children to the `LinearLayout`, and then make the `LinearLayout` scrollable in the X direction only.

This is so close to working, but I can't seem to get (3) in my list above to work: if I'm scrolled all the way to the left, I can't see the vertical scrollbar. Any ideas on how to make this work?

If needed, I can provide screenshots of how things look now, as well as code. It's quite verbose, so I omitted it for now.

# Environment

* Operating system: Ubuntu 20.04
* Backend used: termion
* Current locale: en_US.UTF-8
* Cursive version: 0.15

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.