iced icon indicating copy to clipboard operation
iced copied to clipboard

Switching between two pick lists is not seamless

Open TheGlitch76 opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Is this issue related to iced?

  • [X] My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Switching between two pick lists causes the text in the dropdown of the pick list to change a half second or so before the dropdown is moved to the new pick list. Due to another bug (#1312 ?), OBS crashes when I try to record a video of the bug.

Here is a (poorly written) example:

use std::borrow::Cow;

use iced::{Sandbox, Element};
use iced::widget::{pick_list, row};

fn main() -> iced::Result {
    App::run(iced::Settings::default())?;
    Ok(())
}

struct App {
    list_one: Vec<&'static str>,
    list_one_selected: Option<&'static str>,
    list_two: Vec<&'static str>,
    list_two_selected: Option<&'static str>
}
#[derive(Debug, Copy, Clone)]
enum Message {
    ListOne(&'static str),
    ListTwo(&'static str)
}

impl Sandbox for App {
    type Message = Message;
    fn new() -> Self {
        Self { list_one: vec!("one", "two", "three"), list_one_selected: Option::None, list_two: vec!("alpha", "bravo", "charlie"), list_two_selected: Option::None}
    }
    fn title(&self) -> String {
        String::from("Bugcheck")
    }
    fn update(&mut self, _message: Message) {
        return
    }
    fn view(&self) -> Element<Self::Message> {
        let list_one =  pick_list(Cow::from(self.list_one.clone()), self.list_one_selected.clone(), Message::ListOne);
        let list_two = pick_list(Cow::from(self.list_two.clone()), self.list_two_selected.clone(), Message::ListTwo);

        row![list_one, list_two].into()
    }
}

What is the expected behavior?

Switching between pick lists should be seamless.

Version

master

Operative System

Linux

Do you have any log output?

No response

TheGlitch76 avatar Oct 24 '22 18:10 TheGlitch76