Questions tagged [gtk-rs]

Rust bindings for GTK+, Cairo, GtkSourceView and other GLib-compatible libraries

94 questions
1
vote
2 answers

How to send key-press events to an inactive Entry with GTK

I have a GTK window with two elements, an Entry that functions as a search input and a ListBox that displays search results. When the ListBox has focus (e.g. the user is navigating it with arrow keys) I'd like to direct any character key presses…
Michael
  • 462
  • 1
  • 6
  • 18
1
vote
1 answer

Rust closure errors -> ...which is owned by the current function | capture of moved value:

This code: //let seen_cell = std::cell::RefCell::new(window_0); window_0.connect_delete_event(|_, _| { //window_0.destroy(); window.hide(); Inhibit(true) }); button_0.connect_clicked(|_|{ window.show_all(); } …
Angel Angel
  • 19,670
  • 29
  • 79
  • 105
1
vote
0 answers

How can I integrate code into the GTK main loop?

I have working code without a GUI which manages some threads. Now I want to integrate it with a GUI created in GTK. It builds the GUI with test_glade which makes use of gtk::main: fn main() { //.. test_glade(); //.. // Question…
Angel Angel
  • 19,670
  • 29
  • 79
  • 105
0
votes
1 answer

Render on click on the GLArea (Glium backend)

I want to perform a render on click event on the GLArea. The problem is that when I call the drawing method from the event handler, the "canvas" does not change. There is the my_draw_func() method in the Renderer struct, that contains the render…
0
votes
1 answer

Binding property from within custom GTK widget, `self` does not implement ObjectType despite being a widget

I'm using gtk-rs with GTK4. I have a custom widget representing a row in a GtkListView widget. My custom widget (MyRow) is defined exactly as done in the book (see https://github.com/gtk-rs/gtk4-rs/tree/master/book/listings/todo/1/task_row). I want…
Nicolas
  • 6,611
  • 3
  • 29
  • 73
0
votes
0 answers

Gtk-rs Button::connect_clicked does nothing

I'm using glade to design a GUI and then loading it with rust and using the gtk-rs library. When I use the connect_clicked function on a gtk::Button it does nothing when I click the button. I know that the button is there because I can see it in the…
0
votes
1 answer

get contents from an entry box in gtk-rs with a button

I was trying to make a button that would get the contents of an entry box and print it to the terminal but I couldn't really find anything that helped. Could anyone help me? I looked for solutions but didn't really find anything.
sxtj
  • 1
  • 1
0
votes
0 answers

How to make a GTK-RS dropdown searchable

I am using GTK-RS to develop an application and I am struggling to make a dropdown searchable. The documentation for drop-down has a method for making them searchable which states you need to use an expression however I do not know how to…
John554
  • 145
  • 1
  • 7
0
votes
1 answer

How to set the GTK4 tooltip delay in gtk-rs?

I can do like let button = Button::builder().label("Click me..!") .tooltip_text("You have to click this..!") .margin_top(24) .margin_bottom(24) …
Redu
  • 25,060
  • 6
  • 56
  • 76
0
votes
1 answer

How to write custom Container in gtk-rs?

How can I write a custom Container in gtk-rs for GTK-3? I use gtk-rs 0.15.0 (to be compatible with the last GTK-3 compatible version of webkit2gtk). I couldn't find any reasonable documentation. Reason behind this: I use a horizontally aligned Box…
0
votes
1 answer

Get Parent From gtk-rs CompositeTemplate

How do I get the parent of a CompositeTemplate in gtk-rs? #[derive(Debug, Default, gtk::CompositeTemplate)] #[template(resource = "/org/bil4x4/gnote/tree_view")] pub struct GnoteTreeView { #[template_child] pub…
0
votes
1 answer

Triggering code after the window has been shown

I'm using gtk-rs. I want to trigger some code after the window has been shown (has displayed on the screen): window.connect_show(clone!(@weak window => move |_| { let command = format!("sleep 0.1; wmctrl -r \"CSS\" -e 1,640,100,680,768"); …
alexchenco
  • 53,565
  • 76
  • 241
  • 413
0
votes
0 answers

How to properly use IconTheme with gtk-rs

I am having some trouble loading additional icons into a IconTheme. At the moment my code is adding the path which is showing correctly with search_path() however it always returns false when I check for an image with has_icon(). Are there any…
John554
  • 145
  • 1
  • 7
0
votes
0 answers

How to make gir look only on local bindings

When I try to generate Rust FFI via gir, it always seems to try to find used dependencies. So I have a Gir.toml like that: [options] girs_directories = ["../foo_gir"] library = "Foo" version = "0.1" target_path = "." min_cfg_version =…
abergmeier
  • 13,224
  • 13
  • 64
  • 120
0
votes
1 answer

Updating UI elements from a async loop

What is the standard method for updating UI elements from a loop calling a web request in Rust using gtk-rs? I am having trouble updating a label in a UI element to display some data from a web request. Is there a standard way of doing this? The…
John554
  • 145
  • 1
  • 7