Closed aberba closed 4 years ago
That depends on layout you use. In the example above you use GroupLayout which has some settings predefined because intended for rapid prototyping. I would recommend to try other layouts to get result you need.
In the following example BoxLayout with vertical orientation is used to avoid padding.
import arsd.nanovega;
import nanogui.sdlbackend : SdlBackend;
class MyGui : SdlBackend
{
this(int w, int h, string title)
{
super(w, h, title);
}
override void onVisibleForTheFirstTime()
{
import nanogui.widget, nanogui.screen, nanogui.checkbox, nanogui.label,
nanogui.common, nanogui.window, nanogui.layout, nanogui.button, nanogui.popupbutton,
nanogui.entypo, nanogui.popup, nanogui.vscrollpanel,
nanogui.combobox, nanogui.textbox;
auto window = new Window(screen, "Button demo", true);
window.position(Vector2i(15, 15));
window.size = Vector2i(140, 170);
window.layout(new BoxLayout(Orientation.Vertical));
new Label(window, "Push buttons", "sans-bold");
auto checkbox = new CheckBox(window, "Checkbox #1", null);
checkbox.position = Vector2i(100, 190);
checkbox.size = checkbox.preferredSize(ctx);
checkbox.checked = true;
auto label = new Label(window, "Label");
label.position = Vector2i(100, 300);
label.size = label.preferredSize(ctx);
Popup popup;
auto btn = new Button(window, "Button");
btn.callback = () {
popup.children[0].visible = !popup.children[0].visible;
label.caption = popup.children[0].visible ?
"Popup label is visible" : "Popup label isn't visible";
};
auto popupBtn = new PopupButton(window, "PopupButton", Entypo.ICON_EXPORT);
popup = popupBtn.popup;
popup.layout(new GroupLayout());
new Label(popup, "Arbitrary widgets can be placed here");
new CheckBox(popup, "A check box", null);
window.tooltip = "Button demo tooltip";
// now we should do layout manually yet
screen.performLayout(ctx);
}
}
void main()
{
auto gui = new MyGui(1000, 800, "Nanogui demo");
gui.run();
}
I meant padding in the OS window itself. The black container.
hmm... OS windows do not have padding...
See the space around the BoxLayout() in your code... that's what I'm talking about, how do i remove it?
But there is no space around the BoxLayout()... In my code the PopupButton, for example, fills the 'Button demo' window (that has box layout) in horizontal orientation without padding.
In the example above the window has box layout with vertical orientation. That means that all widgets belonging to the window are arranged in vertical top down and in horizontal they are aligned to center. The space below the PopupButton because total height of child widgets of the window is less that the window height. Also the 'Button' button has space on the left and right because the button width is less than the window width. So if you increase the button width or decrease the window width you can control that space. BoxLayout (like other layouts) is not visualized at all so I don't understand what you mean exactly but if you describe it more I definitely try to help. I'll be busy on the weekend, but later I'll be at your service.
The space I've painted with blue. That section.
Now it looks like there are Two windows, the OS window and nanogui window (with title "Button demo). Now the top-level OS window is what I've been talking about. It has padding around the "Demo button" window. Its what I want to remove
Like this
the "Demo button" window is a floating window and user can move it by mouse or programmatically by means of its position property. Did you try to move the window?
In nanogui all windows (both the OS window and nanogui windows) are floating.
@aberba I'm afraid I didn't answer your question?
Did you try to move the window? No. I thought it was fixed.
In nanogui all windows (both the OS window and nanogui windows) are floating.
Oh ok. Then I guess can't do anything about that. What I've been trying to communicate was how to "un-float" the nanogui windows.
Thanks.
Can't you position your nanogui window next to OS window border to avoid padding? and nanogui window w/o header to disable its moving
There seem to be some padding in the window even in the screenshot shown. How do I remove it?