Skip to navigation
Save a rust gtk textview content to the os clipboard
05.04.21
let text_view: gtk::TextView = _builder.get_object("text_view").unwrap(); let textview = get_textview(&text_view); let clipboard = gtk::Clipboard::get(&gdk::SELECTION_CLIPBOARD); clipboard.set_text(&textview); pub fn get_textview(textview: >k::TextView) -> String { let buffer = textview.get_buffer().unwrap(); let start = buffer.get_start_iter(); let end = buffer.get_end_iter(); let g = buffer.get_text(&start, &end, true).unwrap(); let s = g.as_str().to_uppercase(); return s; }
https://gtk-rs.org/docs/gtk/struct.Clipboard.html
Reply
Anonymous
Information Epoch 1732552105
Use lower case and keep it short.
Home
Notebook
Contact us