View previous topic :: View next topic |
Author |
Message |
nikolai
Joined: 25 Aug 2007 Posts: 12
|
Posted: Sat Aug 25, 2007 1:29 pm Post subject: libglade |
|
|
hi
i compiled the glade test from the demos folder of gtkd preview 4, but when i run it and provide a *.glade file as an argument, then this is the output:
nikolai@nikolai-pc:~$ /home/nikolai/gtkD/gladeTest /home/nikolai/gui.glade
Loaded lib = libglade-2.0.so
Loaded lib = libgtk-x11-2.0.so
Loaded lib = libglib-2.0.so
Loaded lib = libatk-1.0.so
Loaded lib = libgobject-2.0.so
Loaded lib = libgdk-x11-2.0.so
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_color_to_string
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_window_beep
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_threads_add_idle
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_threads_add_idle_full
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_threads_add_timeout
Loader.Linker.link trying alternate lib <<<<<<<<< gdk_threads_add_timeout_full
Loaded lib = libgthread-2.0.so
Loaded lib = libpango-1.0.so
loading /home/nikolai/win.glade
and then it does nothing, the program doesn't even exit.
what am i doing wrong? or do i maybe need a D binding for libglade, and if this is the case, where can i download it?
any help would be appreciated.
|
|
Back to top |
|
|
nikolai
Joined: 25 Aug 2007 Posts: 12
|
Posted: Mon Aug 27, 2007 7:26 am Post subject: solved!!! |
|
|
hello
i am sorry i even posted this. the reason i got this message is because i forgot to set the window visible in glade. please excuse me for being stupid, but i am a newbie and i dont know much yet.
nikolai |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Mon Aug 27, 2007 8:53 am Post subject: |
|
|
That's quite alright. Everyone makes mistakes every now and then. Sometimes you just got to step away and come back to it, even if it is something "stupid". We've all done it... |
|
Back to top |
|
|
kaarna
Joined: 03 Apr 2006 Posts: 92 Location: Finland
|
Posted: Wed Aug 29, 2007 2:07 am Post subject: |
|
|
I do "mistakes" like that all the time. But glad to hear you got libglade working then? I haven't tested it on gtkD yet. It worked great for me back in my gtkmm days. |
|
Back to top |
|
|
nikolai
Joined: 25 Aug 2007 Posts: 12
|
Posted: Wed Aug 29, 2007 7:32 am Post subject: |
|
|
libglade works quite nicely, but it is a fraction slower than writing the gui by hand.
But is there someone who can tell me how i assign events to buttons created in Glade, and how to set my program to exit when pressing the close button in the top right corner, because at the moment when i run my program from a terminal i have to press ctrl - c to exit after pressing the close button.
nikolai |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Wed Aug 29, 2007 11:06 am Post subject: |
|
|
I would overwrite the delete_event and connect it to the main window. This will catch whatever is going on and allow you to force it to close. |
|
Back to top |
|
|
nikolai
Joined: 25 Aug 2007 Posts: 12
|
Posted: Thu Aug 30, 2007 8:27 am Post subject: |
|
|
i am a newb, so could you please explain a bit more closely how to do that?
that would be very kind!
Nikolai |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Fri Aug 31, 2007 9:16 am Post subject: |
|
|
For your MainWindow, simply apply the following:
Code: |
addOnDelete(&delete_event);
addOnDestroy(&delete_event);
|
If you are using this() for your MainWindow, simply add those lines within, otherwise if you have a MainWindow called mainWin, add these:
Code: |
mainWin.addOnDelete(&delete_event);
mainWin.addOnDestroy(&delete_event);
|
And then somewhere within your program, overwrite the delete_event with this function:
Code: |
gint delete_event(Event event, Widget widget)
{
GtkD.exit(0);
}
|
This will force the program to exit when they issue the close command or if they click the close button in the top right of the window.
Does that answer your questions? |
|
Back to top |
|
|
nikolai
Joined: 25 Aug 2007 Posts: 12
|
Posted: Fri Aug 31, 2007 1:55 pm Post subject: |
|
|
yes, thank you |
|
Back to top |
|
|
|