GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Aug 22, 2014 5:56 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Glade 3 program with a widget problem
PostPosted: Tue Dec 18, 2012 9:45 am 
Offline
Familiar Face

Joined: Fri Sep 23, 2011 12:04 pm
Posts: 30
I am trying to create a standard starter program for developping Ada programs with use of Gtk.
I copied this program from some example program. but I do get a problem with as the program does create a NULL pointer to a widget. That happens in connection with Glade 3 and the GTk builder (Gtk version 2.24

The program is:

procedure Algemeen is
Builder : Gtkada_Builder;
Error : Glib.Error.GError;
answer : Message_Dialog_Buttons := Button_OK;
Widge : Gtk_Widget;

begin
Gtk.Main.Init;
Gtk_New (Builder);
Error := Add_From_File (Builder, "algemeen.glade");
if Error /= null then
answer := Message_Dialog( Msg => "Error : " & Get_Message (Error),
Buttons => Button_OK,
Title => "Error");
Error_Free (Error);
return;
end if;
Gtk_New (Builder);
Register_Handler
(Builder => Builder,
Handler_Name => "Main_Quit", -- from XML file <signal handler=..>
Handler => Algemeen_Callbacks.On_Window_Destroy'Access);
Do_Connect (Builder);
-- Find our main window, then display it and all of its children.
Widge := Get_Widget (Builder, "algemeen_window"); Widge gets a Null pointer as value
Show_All (Widge); with a Nullpointer Show_All crashes
etc. etc.

The value of Builder looks a coorect value as I can by stepping through the code see the correct buildup of the window.
The name of the mainwindow "algemeen_window" corresponds with the name of the toplevel window in Glade 3

Is there anyone who can tell me what I do wrong or who can Show me a clesr explanation of the way I should use the conversion from a Glade file in my program


Top
 Profile  
 
 Post subject: Re: Glade 3 program with a widget problem
PostPosted: Tue Dec 18, 2012 11:18 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
My ignorance of Ada will probably show through in this. When it comes down to it you're going to have a hard time finding some one with Ada experience and may be better off trying to contact the author of your examples or a similar tutorial (http://wiki.ada-dk.org/building_gui_with_glade_3 was what I found on the net).
You seem to have Gtk_New (Builder); twice in your code. Could this cause a conflict?
Wouldn't the Show_All need to be prefixed as Gtk.Widget.Show_All?
By the way the .glade file produced by libglade is becoming obsolete with a merge towards GtkBuilder. I'm also not too sure how glade files targeted at version 3 go with using in gtk2; probably ok in most cases else you'd hear more about it.


Top
 Profile  
 
 Post subject: Re: Glade 3 program with a widget problem
PostPosted: Tue Dec 18, 2012 12:51 pm 
Offline
Familiar Face

Joined: Fri Sep 23, 2011 12:04 pm
Posts: 30
Thanks, yes the second time GtkNew was the problem. Sometimes you need somebody who looks with a fresh eye, because when you are well into tour work you are blind for such faults.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group