Trying to get a better handle on parent-child window relationships

I've been using fltk-rs for about a year now, but am finding that I still don't really have a good understanding of how fltk widgets behave in the parent/child relationships. For instance, consider the following code:

fn main() {
    let app = App::default();
    let mut primwin = Window::new( 400, 100, 400, 300, "Primary Window");

    let mut secwin = Window::new( 500, 200, 400, 300, "Secondary Window");
    secwin.end();
    secwin.show();

    let mut tertwin = Window::new( 600, 300, 400, 300, "Tertiary Window");
    tertwin.end();
    tertwin.show();

    let mut quadwin = Window::new( 700, 400, 400, 300, "Quadrary Window");
    quadwin.end();
    quadwin.show();

    primwin.end();
    primwin.show();

    app.run().unwrap();
}

My expectation for this code is that since the line

primwin.end();

comes after all the other windows have been created, then those three windows should be children of primwin. That isn't the case because when they are showing and I close primwin those windows continue to show. Even more of a mystery to me is that the second window created, secwin, doesn't show up at all. I've played around with moving the various *.end() and *.show lines in different locations, but can't seem to get the behavior I'm looking for. So, could someone tutor me a little on how all this really works? Thanks.

Ok, so that helps me better understand what is happening with my main project. In that project I have been opening windows independent of the primary window rather than child windows, which is what I thought I was doing. My next need is to choose one of those windows in particular and then refresh the data it displays. So, I've been trying to write a function that will return a list of the windows that are currently open in the main app. That list will then let me identify the particular window I need to update so that I can do stuff with it. (If that sounds rather convoluted and clumsy, it is, but since this project isn't even to the workable prototype stage, I'm okay with that. I'll fix it later.) Anyway, I modified my code from above and added a function suggested by the AI associated with my IDE. Of course, AI's being what they are, the code doesn't work. The function tries to use a method, label(), that apparently doesn't exist. Here's the code above modified to use independent windows followed by the non-working function:

fn main() {
    let app = App::default();
    let mut primwin = Window::new( 400, 100, 1000, 900, "Primary Window");
    primwin.end();
    primwin.show();

    let mut secwin = Window::new( 500, 200, 400, 300, "Secondary Window");
    secwin.set_color(Color::Red);
    secwin.end();
    secwin.show();

    let mut tertwin = Window::new( 600, 300, 400, 300, "Tertiary Window");
    tertwin.set_color(Color::Blue);
    tertwin.end();
    tertwin.show();

    let mut quadwin = Window::new( 700, 400, 400, 300, "Quadrary Window");
    quadwin.set_color(Color::Yellow);
    quadwin.end();
    quadwin.show();

    temp_listwindows(&app);

    app.run().unwrap();
}

pub fn temp_listwindows(app: &App) {

    // Retrieve all open child windows
    let windows = app::windows();  // Returns vector of all windows open in the app.
    println!("\n Currently Open Child Windows: \n");

    for item in windows.iter() {
        let winlabel = item.label();
        println!("\n Window: {} \n", winlabel);
    }


}

And here is the error the compiler throws:

error[E0599]: no method named `label` found for reference `&Vec<impl WindowExt>` in the current scope
  --> src/main.rs:38:29
   |
38 |         let winlabel = item.label();
   |                             ^^^^^ method not found in `&Vec<impl WindowExt>`

So, could you help me get that function working? Thanks.

Since ethe first question was addressed here:

I’ll answer the second question. The windows() function returns an Option of a Vec. You’re currently calling iter() on an Option.

Well, I should have caught that one. That fixed it, too. Check out what I came up with and feel free to point out any issues with it:

// snip -- set up the windows

    let winvec = temp_listwindows(&app);
    println!("\n Currently open windows are: \n");
    for item in winvec {
        println!("{}", item.label());
    }

    app.run().unwrap();
}

pub fn temp_listwindows(app: &App) -> Vec<impl WindowExt> { // Retrieve all open child windows
    let winvec = app::windows().unwrap_or(vec![]);
    winvec
}

windows() is a function of the app module. It’s not a method of the App struct.
So temp_listwindows doesn’t really need the function parameter; you could also do away with the whole function as well.