-
Hi I'm using pane_grid system for my IRC GUI Client. fn update(
&mut self,
message: Self::Message,
_clipboard: &mut Clipboard,
) -> Command<Self::Message> {
....
Message::Clicked(pane) => {
state.focus = Some(pane);
// I'd like to update state using pane.info
state.current_channel = pane.id // Error
state.current_channel = panes[pane] // Error
}
....
}
// In the view function
fn view(&mut self) -> Element<Self::Message> {
.....
let pane_grid = PaneGrid::new(&mut state.panes, |pane, content| {
let is_focused = focus == Some(pane);
// This is working. I can change the view when the user click a panel
....
}
// I'm trying to get information of id or channel_name by implementing Content.
pub struct Content {
pub id: usize,
pub channel_name: String,
scroll: scrollable::State,
split_horizontally: button::State,
split_vertically: button::State,
close: button::State,
} |
Beta Was this translation helpful? Give feedback.
Answered by
yusdacra
Aug 31, 2021
Replies: 1 comment 1 reply
-
You need to use if let Some(pstate) = self.pane_grid_state.get(&pane) {
self.id = pstate.id;
} something like this should work. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to use
self.pane_grid_state.get(&pane)
to get the state of thePane
, and then:something like this should work.