simonkrauter / NiGui

Cross-platform desktop GUI toolkit written in Nim
MIT License
718 stars 50 forks source link

How to make container scrollable? #37

Closed matthiaswh closed 5 years ago

matthiaswh commented 5 years ago

Is it possible to make a container scrollable, independent of the window? Everything seems to be setup for this to work, but I can't find a way to make it happen. I have tried setting fYScrollEnabled on the container, and even setting the fScrollableHeights, but to no avail.

Like so

====================================
=----------------------------------=
=- stationary text box            -=
=----------------------------------=
=----------------------------------=
=- scrollable                   | -=
=- list                         | -=
=- of                           | -=
=- labels                       | -=
=----------------------------------=
====================================
simonkrauter commented 5 years ago

Should work, but doesn't work. I have to check why.

simonkrauter commented 5 years ago

It works under Windows, see https://github.com/trustable-code/NiGui/blob/master/examples/example_14_container_scrolling.nim. Under Gtk it does not work, it expands the inner container and the outer container gets the scrollbar. This needs to be fixed in the Gtk related part.

simonkrauter commented 5 years ago

With the latest commit it should work under Gtk too. Does it work for you?

matthiaswh commented 5 years ago

Works great! I made one small fix that was causing the horizontal scrollbar to show unnecessarily until the window was resized. I don't yet fully understand how all the Gtk code is working but I think this was the correct approach.

Great project btw!