Author Topic: Probleme beim laden einer erstellten GUI mit Glade  (Read 2449 times)

Offline nobbody

  • Single posting newcomer
  • *
  • Posts: 3
Probleme beim laden einer erstellten GUI mit Glade
« on: July 30, 2023, 11:53:21 am »
Hi everyone, I'm having trouble with Code:Blocks loading a GUI I created with Glade 3.38.2. My source code looks like this.

void OnDestroy(GtkWidget *window)
{
    gtk_main_quit();
}

int main (int argc, char *argv[])
{
  GtkBuilder *builder;
  GtkWidget *window;

  /* Initialize GTK+ */

  gtk_init (&argc, &argv);

  builder = gtk_builder_new();
  builder = gtk_builder_add_from_file(builder,"part1.glade",NULL);

  window = GTK_WIDGET(gtk_builder_get_object(builder,"MyFrame"));
  gtk_builder_connect_signals(builder,NULL);

 
  gtk_widget_show(window);
  gtk_main();

 
  return 0;
}
I'm using Code::Blocks 20.03 on the Raspberry Pi 4. I simply created a window via Glade that is completely empty. The only signal I have included is the destruction of the window.
See file part1.glade:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
  <requires lib="gtk+" version="3.24"/>
  <object class="GtkWindow" id="MyFrame">
    <property name="can-focus">False</property>
    <property name="title" translatable="yes">Mein erstes Fenster</property>
    <signal name="destroy" handler="OnDestroy" swapped="no"/>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>

Das ergebniss Sieht dann so aus:


PS.: If you can't see the picture, I've also added it as an attachment.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1630
Re: Probleme beim laden einer erstellten GUI mit Glade
« Reply #1 on: July 30, 2023, 12:15:19 pm »
This is nearly OT.

Have you checked if "part1.glade" is in the execution working dir?

Please use the code tag (the # button) for posting code.