Gtk.ListBox - How to change Text Field from row_activated?

43 Views Asked by At

Helo,

I have a main window.

public class Window : Gtk.ApplicationWindow {
    [GtkChild]

    private unowned Gtk.ListBox listbox_jobs;
    private unowned Gtk.Grid grid_right;

There I have a Gtk.ListBox. This ListBox and the main window are passed to a new class named JobsList:

public JobsList(Gtk.ListBox listbox, Window main) {
   this.listbox = listbox;
   this.main = main;
}

Now in this class I do a row_activated.connect(row_activated):

this.listbox.row_activated.connect(row_activated);

public void row_activated(Gtk.ListBoxRow row) {
  Gtk.Label label = (Gtk.Label)row.get_child();
  string text = label.get_text();

  print(text);
}

This works fine. Now my problem is, that I want to make a GtkGrid grid in window.ui visible, if someone clicks on element in the ListBox. So I do:

this.main.grid_right.set_visible(true);

And i get an error:

The name `grid_right' does not exist in the context of `Gtk.Window' (gtk+-3.0)

What am I doing wrong?

0

There are 0 best solutions below