question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I make long forms or nested layouts that are scrollable?

See original GitHub issue

When building applications that prompt rich forms, we may need the capability that we could scroll some long contents, optionally with viewport following the cursor. An example that implements this concept is nmtui.

long form in nmtui

If a widget is simple, one approach is to (ab)use FormattedTextControl inside a window, typesetting (?) the content of each block and arrange cursor positions. This idea works well with smaller components, and is already seen in widgets like CheckboxList, #711 for editable buffers, and the option list of pyvim (this is especially brilliant, in my oponion).

When building some complex blocks to compose them, the logic to maintain contents/positions for a long block would be a nightmare. For an instance of what I mean complex, see cslack, in urwid.

complex form

It is straightforward to mock a view using HSplit and VSplit, however they seem to divide the screen and cannot be placed inside a window. I have seen a similar feature request in #949 and surveyed some showcases, but still have no idea on how to achieve this. Maybe I should start by inheriting UIContent. Is there some development docs that I can refer to create such a component?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jonathanslenderscommented, Oct 22, 2021

Actually, this was implemented some time ago, using prompt_toolkit.layout.ScrollablePane. I forgot to mention it here.

See these examples: https://github.com/prompt-toolkit/python-prompt-toolkit/tree/master/examples/full-screen/scrollable-panes

Hope that works!

2reactions
jonathanslenderscommented, Jan 28, 2020

Hi @andy0130tw,

This is indeed a feature request that’s been asked a couple of times before, and I haven’t come around implementing it. At the moment it is not possible.

It should be doable, but not really easy either. If I have some time, I’ll try to write down the steps to implement it.

I’m not entirely sure, but maybe it is possible to implement with Urwid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experimenting with Nested Scrolling - Android Design Patterns
Introduced in API 21, the nested scrolling APIs make it possible for a scrollable parent view to contain scrollable children views, enabling us ......
Read more >
How do you make a LinearLayout scrollable?
Since ScrollView can have only one child, that child is a linear layout. Then all the other layout types occur in the first...
Read more >
Xamarin.Forms ScrollView
A ScrollView can only have a single child, although this can be other layouts. Warning. ScrollView objects should not be nested.
Read more >
Figma Tutorial: Device Frames and Scrolling - YouTube
In this video, we'll teach you how to make your Prototypes more immersive through the use of scrolling and device frames.
Read more >
Office Hours: Scroll actions for your prototypes - YouTube
Catch up on Office Hours with Niko and Aaron from Figma to level up on some new prototyping capabilities, you'll definitely want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found