Closed leyloe closed 1 month ago
libui-rs is just a wrapper around libui-ng and will use whatever it is using. Also there should be nothing in the way for someone to just port the project over to GTK4. I for my part will happily point this wrapper at whatever libui fork works best.
libui-rs is just a wrapper around libui-ng and will use whatever it is using.
Also there should be nothing in the way for someone to just port the project over to GTK4. I for my part will happily point this wrapper at whatever libui fork works best.
Also, two questions i have:
there was a question related to this library made here: https://users.rust-lang.org/t/enter-detection-on-libui-rs/
also how can i get this labled box? in this great example i found, there was a box wrapped around labels, and it was labeled as statistics. i am currently using the layout macro and i prefer it, and that labeled box/border would help alot
anyway thank you
EDIT: so i got something similar to the statistics tab called group, and i put a label in there, but now that label has a grayish backround on windows, how do i get rid of that?
@fu3x11, as you already found out, the control you are looking for is called "Group" in libui-rs, or "Groupbox" under Windows. The controlgallery example is using it on page 1 and the builder example is using it as well with the layout! macro.
The background of the group box should be inherited from its parent, as is the case with the label. So on a tab, it will be white. Directly in the window it will be a gray background. If using the default white Windows theme of course.
@fu3x11, as you already found out, the control you are looking for is called "Group" in libui-rs, or "Groupbox" under Windows. The controlgallery example is using it on page 1 and the builder example is using it as well with the layout! macro.
The background of the group box should be inherited from its parent, as is the case with the label. So on a tab, it will be white. Directly in the window it will be a gray background. If using the default white Windows theme of course.
also on windows, the border around the text for buttons are very shrinked as such
when its supposed to be
i wasnt able to resolve it without manually adding spaces, but it looked ugly on linux, so i had to put it behind a macro. is there a more robust way to fix the button?
secondly the group creates a grey on white with the code below:
use libui::{
controls::{Group, HorizontalBox, Label, TabGroup, VerticalBox},
prelude::{LayoutStrategy, Window, WindowType},
UI,
};
extern crate libui;
fn main() {
let ui = UI::init().unwrap();
let mut layout = HorizontalBox::new();
let mut window = Window::new(&ui, "ui", 640, 480, WindowType::NoMenubar);
let mut tabs = TabGroup::new();
let label = Label::new("hello");
let mut group = Group::new("Entries");
group.set_margined(true);
group.set_child(label);
let mut vbox = VerticalBox::new();
vbox.append(group, LayoutStrategy::Stretchy);
tabs.append("Tab1", vbox);
layout.append(tabs, LayoutStrategy::Stretchy);
window.set_child(layout);
window.show();
ui.main();
}
Button spacing: You'll have to layout the buttons with VerticalBox, HorizontalBox, Form and LayoutGrid somehow.
Label Background: Those background issues are classic Win32 problems. There was no real transparency, so they faked it by rendering with the parent controls background color. Depending on which order controls are drawn and in which control they are hosted things like this can occur.
In your case, it seems to help to have the label in VerticalBox or HorizontalBox like below and not directly as child of the groupbox.
...
let mut vbox_label = VerticalBox::new();
vbox_label.append(label, LayoutStrategy::Compact);
group.set_child(vbox_label);
...
Button spacing: You'll have to layout the buttons with VerticalBox, HorizontalBox, Form and LayoutGrid somehow.
Label Background: Those background issues are classic Win32 problems. There was no real transparency, so they faked it by rendering with the parent controls background color. Depending on which order controls are drawn and in which control they are hosted things like this can occur.
In your case, it seems to help to have the label in VerticalBox or HorizontalBox like below and not directly as child of the groupbox.
... let mut vbox_label = VerticalBox::new(); vbox_label.append(label, LayoutStrategy::Compact); group.set_child(vbox_label); ...
grid.append(
start,
1,
1,
1,
1,
GridExpand::Horizontal,
GridAlignment::Fill,
GridAlignment::Fill,
);```
i dont really see anything different
I do not understand. Did formatting issues mess up your reply?
I do not understand. Did formatting issues mess up your reply?
probably
i mean i dont mind gtk3, but will this move to gtk4 as gtk3 goes out of scope officially