Questions about window settings

I’m trying to get a good handle on how to use/modify the settings of an individual Iced window. Here are some questions:

  1. pub visible: bool – My understanding of this setting is that if set to true the window will not show until it is activated later. I can see how that might be desirable, but am unable to come up with a simple, concrete example. Could someone provide that for me and maybe discuss the topic a little? Thanks.

  2. pub decorations: bool – I’ve already posted this question here and am waiting for a reply.

  3. pub transparent: bool – I haven’t been able to get this setting to work. I’m assuming that the default value is false, so I changed it to true and see no difference. Is this feature not working? Here is the code I used to change the value:

It doesn’t run in Playground, but at least you can view the code there.

  1. pub icon: Option<Icon> – This setting remains a mystery to me. Apparently the default is for there to be no icon. None of the windows I’ve opened while exploring Iced have had an icon. Here’s what the documentation says:
pub struct Icon { /* private fields */ }

A window icon normally used for the titlebar or taskbar.

I find the /* private fields */ to be very confusing and haven’t been able to find any examples or other discussion of how to use this feature. Any light shed on the subject will be appreciated. :>)

  1. pub platform_specific: PlatformSpecific – Here’s another one I don’t know what to do with. It’s a struct with a single field named application_id. Are we talking OS maybe? I’m using Linux. Does this setting affect how Ice behaves, say, in Windows? Or, maybe, IOS? Again, any insight will be appreciated.

Finally, while typing out these questions it occurred to me that some of these features may simply not be fully implemented yet. After all, our current version is only “0.10.0” and I know the developers are working hard at keeping it progressing. If that’s the case, and it’s only to be expected, really, then I’d like to know about it so that I don’t use up any more time trying to make these features work.

Thanks for your help.

1 Like

Actually, for Sandbox and Application, there are “simplest” examples. I asked about it in a previous post and @hecrj , the creator of Ice, pointed me to the Sandbox example. I just checked Application and it also has a simple example that one can use to begin incorporating Iced into the projects we are developing. Here are links:

Sandbox simplest

Application simplest

I share your other goals, although they are quite ambitious. I believe there is a mechanism for both Iced and Rust that allows for user contribution. You might want to check it out. Search the Iced Github for “Contribution guidelines”.

My goal, at least with this post, is currently limited to editing the documentation for Iced window settings with the objective of making it more readable/usable. I’ve started that document, but I really need answers to the above questions before I can continue. These questions have been languishing here in forum limbo for quite a while now. The real issue is that the people who know those answers are all busy people with day jobs. In my experience, I have also found that technically-oriented people like software developers tend to love short, succinct communication that is not always all that informative. While that causes me some frustration, I do understand it. They are not teachers (like me) and have difficulty pulling their thinking/communications down to a level that matches the needs of their readers. They are who they are and we need to be accepting/patient with that.

That said, I’m really hoping that one of the devs will find time to answer my questions so I can finish my document and, hopefully, submit it as a contribution to the documentation.

@shoutmarble I took that “simplest example” from the Sandbox documentation and modified it somewhat for use when I am starting a new project. Here is that code, if you are interested:

#![allow(dead_code)]
#![allow(unused)]

/*
    Description

*/    

use iced::widget::text;
use iced::window;
use iced::{Element, Sandbox, Settings};

const PROGRAM_TITLE: &str = "ProgramTitle";
const VERSION: &str = "0.0.1";

struct Somestruct;

#[derive(Debug)]
enum Message {}

impl Sandbox for Somestruct {
    type Message = Message;

    fn new() -> Somestruct {
        Somestruct
    }

    fn title(&self) -> String {
        String::from(PROGRAM_TITLE)
    }

    fn update(&mut self, _message: Self::Message) {
        // This application has no interactions
    }

    fn view(&self) -> Element<Self::Message> {
        "Hello, world!".into()
    }
} // End Somestruct/Sandbox impl

pub fn main() -> iced::Result {
    Somestruct::run(Settings::default())
}

And…yes, there are items in the above code that I do not yet fully understand. Part of that deals with learning Iced and part of it is that I’m still, basically, an inexperienced Rust amature.

Well, it has been a few months since I first posted this thread, and still no reply. I’m adding this post in hopes it will bump it up in the queue where it might get the attention of someone who knows the answers I’m looking for. I still would like to contribute to the documentation, even if it’s only in a small way. Besides, I still hope to eventually incorporate the Iced GUI into my project.

  • The transparent option was broken for a while on the gpu renderer, should be fixed as of commit a613079.
  • Check iced::window::icon - Rust for the documentation with icons.
  • The platform-specific settings use a different struct for different targets, and should be used with a #[cfg(target_os = "<target_os>")] to prevent using the wrong struct for the wrong platform. Other platforms have different contents (mac, for example, has bools for title_hidden, titlebar_transparent, and full_content_view).