hello,
i want to write an app to get some data from internet, this operate will take a long time, so i want to fetch data on a thread. when get finished, put data into text box.
struct App {
btn: gtk::Button,
text: gtk::Entry,
}
impl App {
fn get_data(&mut self) {
// work
thread::spawn(move || {
// fetch data from internet, it takes a long time
// TODO: put data into self.Entry
});
}
}
....
fn gui_main() {
... // construct items
let app = Rc::new(RefCell::new(App{....}); // init
let a = app.clone();
// connect event
btn.connect_clicked(move |_| {App::get_data(a.deref().borrow_mut().deref_mut());});
}
and i dont know how to put data into my gtk::Entry, can any body give me a example code ? please.