On Tue, 09 Oct 2018 16:47:04 GMT, aedt wrote:
Hi. I can't figure out why there is a massive space between the vertical borders and the box in the middle?
~ "should not be taking up the entire " ~ "width allocated to it, but automatically " ~ "wraps the words to fit.\n" ~ " It supports multiple paragraphs correctly, " ~ "and correctly adds " ~ "many extra spaces. "; int main(string[] args) { import gio.Application : GioApp = Application; import gtk.Application : Application; import gtk.ApplicationWindow : ApplicationWindow, GApplicationFlags; auto app = new Application("org.gitlab.radagast.gtkdnotes", GApplicationFlags.FLAGS_NONE); app.addOnActivate(delegate void(GioApp _) { auto aw = new ApplicationWindow(app); scope (success) aw.showAll(); aw.setTitlebar(() { import gtk.HeaderBar : HeaderBar; auto hb = new HeaderBar(); hb.setTitle("Label"); hb.setSubtitle("Demo"); hb.setShowCloseButton(true); return hb; }()); aw.add(() { import gtk.Label : Label; import gtk.Box : Box; import gtkc.gtktypes : GtkOrientation; auto vbox = new Box(GtkOrientation.VERTICAL, 5); vbox.packStart(() { auto hbox = new Box(GtkOrientation.HORIZONTAL, 10); hbox.packStart(new Label("This is a normal label"), true, true, 0); hbox.packStart(() { auto lb = new Label(L1); lb.setLineWrap(true); return lb; }(), true, true, 0); return hbox; }(), true, true, 0); return vbox; }()); }); return app.run(args); }
Note that the window cannot be shrunk vertically.
pardon the incomplete code, here is the complete code:
immutable string L1 = "This is an example of a line-wrapped label. It "
~ "should not be taking up the entire " ~ "width allocated to it, but automatically "
~ "wraps the words to fit.\n" ~ " It supports multiple paragraphs correctly, "
~ "and correctly adds " ~ "many extra spaces. ";
int main(string[] args) {
import gio.Application : GioApp = Application;
import gtk.Application : Application;
import gtk.ApplicationWindow : ApplicationWindow, GApplicationFlags;
auto app = new Application("org.gitlab.radagast.gtkdnotes", GApplicationFlags.FLAGS_NONE);
app.addOnActivate(delegate void(GioApp _) {
auto aw = new ApplicationWindow(app);
scope (success)
aw.showAll();
aw.setTitlebar(() {
import gtk.HeaderBar : HeaderBar;
auto hb = new HeaderBar();
hb.setTitle("Label");
hb.setSubtitle("Demo");
hb.setShowCloseButton(true);
return hb;
}());
aw.add(() {
import gtk.Label : Label;
import gtk.Box : Box;
import gtkc.gtktypes : GtkOrientation;
auto vbox = new Box(GtkOrientation.VERTICAL, 5);
vbox.packStart(() {
auto hbox = new Box(GtkOrientation.HORIZONTAL, 10);
hbox.packStart(new Label("This is a normal label"), true, true, 0);
hbox.packStart(() {
auto lb = new Label(L1);
lb.setLineWrap(true);
return lb;
}(), true, true, 0);
return hbox;
}(), true, true, 0);
return vbox;
}());
});
return app.run(args);
}