Hi.
I’m trying to create a multiline St.Entry
with line wrapping and a scrollbar, but for some reason the scrollbar never appears, no matter how many lines of text the St.Entry
contains. Here’s code:
const entry = new St.Entry({
text: `Some very long multiline text`,
x_expand: true,
});
entry.clutter_text.single_line_mode = false;
entry.clutter_text.activatable = false;
entry.clutter_text.line_wrap = true;
entry.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
const layout = new St.BoxLayout();
layout.add_child(entry);
const scrollView = new St.ScrollView({
hscrollbar_policy: St.PolicyType.NEVER,
vscrollbar_policy: St.PolicyType.AUTOMATIC,
width: 600,
});
scrollView.add_actor(layout);
const dialog = new ModalDialog.ModalDialog();
dialog.contentLayout.add_child(scrollView);
dialog.addButton({
isDefault: true,
key: Clutter.KEY_Escape,
label: 'Close',
action: () => dialog.close(),
});
dialog.open();
What am I doing wrong?