GTK: Endless lazy widget list

I need to display an almost endless list of interactive widgets with scrolling and add / remove them as needed when adding new data or scroll the user to an inaccessible area.

A TreeView ( as given here ) is not an option because I need complete widgets as elements (consisting of standard widgets with several actions, etc., but CellRenderer isn’t for this)

Worse, I do not know the height of the widget in advance (there is not much dispersion), so using a VBox can cause animation.

Using the scroll bar will still look as if the list were finite (that is, it is updated only after the scroll is completed, so the scroll button does not bounce off your mouse), and when the window size and window layout are changed, the scroll position should not change much (the focused widget should remain where it is, unless, of course, the focused widget did not scroll ...).

What is the best way to do this? Maybe even a library that just sends me signals when I need to add a new widget?

Or is it possible to get ListView to do this in a not-so-nasty way? (i.e. draw an off-screen buffer, copy it to a cell using CellRenderer, pass mouse / keyboard events to a real widget?)

+6
source share
1 answer

If this is an infinity list, then you should not try to achieve anything with the scroll bar - this is only for leaf lists.

My suggestion is to use a 2-button overlay

+------------+ | UP ARROW | +------------+ | ITEM N | | ITEM N+1 | | ITEM N+2 | +------------+ | DOWN ARROW | +------------+ 

For a list between buttons, you probably have to implement your own container widget yourself. I suggest pre-storing n (> = 2) widgets / elements in each direction.

Not related to custom containers, but custom widgets are the starting point

http://zetcode.com/tutorials/cairographicstutorial/customgtkwidget/

http://gnomejournal.org/article/34/writing-a-widget-using-cairo-and-gtk28

http://old.nabble.com/Custom-container-%2B-Child-type-with-interface-td26863728.html

+1
source

Source: https://habr.com/ru/post/907084/


All Articles