gyscos / gyscos/cursive

Constraining size based on other views

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

Description

This is maybe a feature request, but more of just a question about using the library:
I have a fixed sized view here on the right, and a full with `.full_width()` on the left:

Image

It works great. I can resize the window and the small column never gets wider, while the resizes to fit the screen.

...until something wider than the TextView gets appended

Image

Then it grows until it takes the entire width of the screen before wrapping.

I can't figure out how I'm supposed to constrain it's size properly. `AtMost` and `Fixed` both require an actual value, which I haven't figured out a way to dynamically find. I tried adding a callback to `Event::Refresh` or `Event::WindowResize` than uses `siv.screen_size().x` and change the `max_width` of that view, but everything I've tried either results in the callbacks never running, or getting a screen width of 0.

I just want it to take up the entire screen minus the width of any fixed size views.

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.