Skip to content

Commit

Permalink
add scroll to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
0chroma committed Sep 12, 2024
1 parent eb22f6a commit 8919747
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/chat_feed.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gtk::prelude::{GridExt, WidgetExt};
use gtk::prelude::{AdjustmentExt, GridExt, WidgetExt};

use relm4::{
binding::StringBinding,
Expand Down Expand Up @@ -30,6 +30,7 @@ impl SimpleComponent for ChatFeed {

view! {
#[root]
#[name="scrolled_window"]
gtk::ScrolledWindow {
set_vexpand: true,

Expand All @@ -40,6 +41,14 @@ impl SimpleComponent for ChatFeed {
}
}
}

}

fn post_view() {
let adj = scrolled_window.vadjustment();
let new_adj = adj.clone();
new_adj.set_value(adj.upper() - adj.page_size());
scrolled_window.set_vadjustment(Some(&new_adj));
}

fn init(
Expand Down

0 comments on commit 8919747

Please sign in to comment.