So I’m trying to make an app with checkboxes with the buttons on the bottom of the window.
The problem is that the list extends vertically when I add a lot of items and it moves the buttons and extends window vertically, too. Is there some workarounds about it?
Here’s my window.ui
(minimal, without things that don’t matter):
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleApp" parent="GtkApplicationWindow">
<property name="title">Example App</property>
<child>
<object class="GtkGrid" id="gtk_box">
<child>
<object class="GtkGrid">
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
<child>
<object class="GtkListBox" id="mod_list">
<property name="visible">True</property>
<property name="width-request">320</property>
<property name="overflow">1</property>
<property name="vexpand">false</property>
<property name="height-request">320</property>
<property name="selection-mode">none</property>
<style>
<class name="boxed-list" />
</style>
</object>
</child>
<child>
<object class="GtkGrid">
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
<child>
<object class="GtkButton">
<property name="label">Button 1</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Button 1</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Button 1</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Button 1</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid">
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
<child>
<object class="GtkButton">
<property name="label">Save</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Save and Play</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
<property name="action-name">win.check_mod</property>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
</interface>
As you might have noticed, I tried to use properties overflow: 1
and vexpand
(both false
and False
) but that didn’t work.
Update: I will probably replace GtkListBox with GtkColumnView Gtk.ColumnView