0

For example:

fn main() {
// Create a new application
let app = Application::builder().application_id(APP_ID).build();

    // Connect to "activate" signal of `app`
    app.connect_activate(build_ui);
    
    // Run the application
    app.run();

}
fn build_ui(app: &Application) {
// Create a window
let window = ApplicationWindow::builder()
.application(app)
.title("my window")
.build();
    // Create a box to hold all the panes
    let parent = gtk::Box::builder()
        .orientation(gtk::Orientation::Vertical)
        .spacing(0)
        .build();
    
    let settings_button =  gtk::Button::builder()
    .margin_start(0)
    .margin_bottom(80)
    .margin_top(80)
    .margin_end(80)
    .hexpand(false)
    .vexpand(false)
    .label("")
    .build();
    parent.add(&settings_button); // gives trait bound errors.
    
    window.set_child(Some(&parent));
    
    // Present the window
    window.present();
    
    }

the methodaddexists for structBox, but its trait bounds were not satisfied the following trait bounds were not satisfied: gtk4::Box: IsAwhich is required bygtk4::Box: gtk4::prelude::CellAreaExt`

I want to add 3 buttons. One at left-most corner, other at right-most corner and third one in center of the box not in between without using CSS. ::prepend works, but I do not want to add one after other.

  • Please [edit](https://stackoverflow.com/posts/75934367/edit) your question to include the _full_ error message (from `cargo check`, not from an IDE since IDEs tend to hide critical details from the errors). – Jmb Apr 05 '23 at 07:47

0 Answers0