Skip to content

Commit 809063c

Browse files
Added search to the ComboRow in BoxedLists (#96)
1 parent df67fda commit 809063c

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/Boxed Lists/main.blp

+7-6
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,18 @@ Adw.StatusPage {
8080
};
8181
}
8282

83-
Adw.ComboRow {
83+
Adw.ComboRow drop_down {
8484
title: _("Choose an Item");
8585
subtitle: _("List of options from a drop down");
86+
enable-search: true;
8687

8788
model: StringList list {
8889
strings [
89-
"This",
90-
"Is",
91-
"A",
92-
"String",
93-
"List"
90+
"Cat",
91+
"Dog",
92+
"Hippo",
93+
"Duck",
94+
"Dodo"
9495
]
9596
};
9697
}

src/Boxed Lists/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import GObject from "gi://GObject";
2+
import Gtk from "gi://Gtk";
3+
4+
const drop_down = workbench.builder.get_object("drop_down");
5+
6+
drop_down.connect("notify::selected-item", () => {
7+
const selected_item = drop_down.selected_item.get_string();
8+
console.log(selected_item);
9+
});
10+
11+
const expression = new Gtk.ClosureExpression(
12+
GObject.TYPE_STRING,
13+
(obj) => obj.string,
14+
null,
15+
);
16+
drop_down.expression = expression;

0 commit comments

Comments
 (0)