Getting auto-height of ShortcutsSection working when creating a ShortcutsWindow programmically

When I to create a help overlay programmatically auto-height is ignored. All shortcuts are listen in one column. I have this sample code:

use gtk::prelude::*;
use gtk::{ApplicationWindow, Button, ShortcutsWindow};

const GENERAL_SHORTCUTS: [(&str, &str); 3] = [
    ("Open Command Pallette", "<Primary><Shift>P"),
    ("Quit", "<Primary>Q"),
    ("Re-execute Last Script", "<Primary><Shift>B"),

const EDITOR_SHORTCUTS: [(&str, &str); 12] = [
    ("Undo", "<Primary>Z"),
    ("Redo", "<Primary><Shift>Z"),
    ("Move line up", "<Alt>Up"),
    ("Move line down", "<Alt>Down"),
    ("Move cursor backwards one word", "<Primary>Left"),
    ("Move cursor forward one word", "<Primary>Right"),
    ("Move cursor to beginning of previous line", "<Primary>Up"),
    ("Move cursor to end of next line", "<Primary>Down"),
    ("Move cursor to beginning of line", "<Primary>Page_Up"),
    ("Move cursor to end of line", "<Primary>Page_Down"),
    ("Move cursor to beginning of document", "<Primary>Home"),
    ("Move cursor to end of document", "<Primary>End"),

const APP_ID: &str = "org.gtk_rs.HelloWorld2";

fn main() {
    let app = adw::Application::builder().application_id(APP_ID).build();

fn build_ui(app: &adw::Application) {
    let window = ApplicationWindow::builder()
        .title("My GTK App")


    let shortcutswindow = gtk::builders::ShortcutsWindowBuilder::new().modal(true).build();

    let general_group = gtk::builders::ShortcutsGroupBuilder::new().title("General").build();
    for (title, accelerator) in GENERAL_SHORTCUTS.iter() {
    let editors_group = gtk::builders::ShortcutsGroupBuilder::new().title("Editor").build();
    for (title, accelerator) in EDITOR_SHORTCUTS.iter() {
    let section = gtk::builders::ShortcutsSectionBuilder::new().max_height(6).section_name("section1").title("section1").build();



How can I make ShortcutsSection distribute the shortcuts over multiple columns?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.