[Gtk-sharp-list] Glade and Dialog Windows

Everaldo Canuto everaldo_canuto@yahoo.com.br
Mon, 25 Oct 2004 16:33:33 -0300 (ART)


Hi Andrea,

Do you have included about_dialog.glade in resource
list? Send your prjx file.

Everaldo.


 --- Andrea Colanicchia <andrea.colanicchia@gmail.com>
escreveu: 
> I designed a dialog window with glade and I included
> it in my application.
> 
> The compilations gone without errors and warnings,
> but when I ran the
> applications the output was:
> 
> Unhandled Exception: System.NullReferenceException:
> Object reference
> not set to an instance of an object
> in (unmanaged) (wrapper managed-to-native)
> Glade.XML:glade_xml_new_from_buffer
> (byte[],int,string,string)
> in <0x00004> (wrapper managed-to-native)
> Glade.XML:glade_xml_new_from_buffer
> (byte[],int,string,string)
> in <0x00133> Glade.XML:.ctor
> (System.Reflection.Assembly,string,string,string)
> in [0x00030] (at
>
/home/andrea/MonoDevelopProjects/Mybrowser/Main.cs:30)
> GladeApp:.ctor
> (string[])
> in [0x00001] (at
>
/home/andrea/MonoDevelopProjects/Mybrowser/Main.cs:20)
> GladeApp:Main
> (string[])
> 
> 
> ------------------
> MAIN FILES
> ------------------
>
-----------------------------------------------------------
> Main.cs
>
-----------------------------------------------------------
> 
> // project created on 20/10/2004 at 16:32
> using System;
> using System.IO;
> using Gtk;
> using Glade;
> using Gecko;
> 
> public class GladeApp
> {
>         [Widget] Frame frame1;
>         [Widget] Window window1;
>         [Widget] Dialog dialog1, dialog2;
>         [Widget] Button closebutton1;
>         
>         WebControl web;
>         
>         public static void Main (string[] args)
>         {
>                 new GladeApp (args);
>         }
> 
>         public GladeApp (string[] args) 
>         {
>                 Application.Init();
> 
>                 Glade.XML gxml = new Glade.XML(null,
> "gui.glade",
> "window1", null);
>                 gxml.Autoconnect(this);
>  
>                 Glade.XML gxml2 = new
> Glade.XML(null,
> "about_dialog.glade", "dialog1", null);
>                 gxml2.Autoconnect(this); // line 31
>                
>                 web = new WebControl();
>                 web.Show();
>                 
>                 frame1.Add(web);                
>                 
>                 Application.Run();
>         }
> 
>         /* Connect the Signals defined in Glade */
>         public void OnWindowDeleteEvent (object o,
> DeleteEventArgs args) 
>         {
>                 Application.Quit ();
>                 args.RetVal = true;
>         }
>         
>         void on_open1_activate (object source,
> EventArgs args)
>         {
> 			FileSelection fs = new FileSelection ("Choose a
> file");
> 			fs.Run ();
> 			
> 			if (File.Exists(fs.Filename))
> 			{
> 				web.LoadUrl(fs.Filename);
> 			}
> 			
> 			fs.Hide ();
>         }
>         
>         void on_quit1_activate (object source,
> EventArgs args)
>         {
>                 Application.Quit ();
>         }
>         
>         void on_about1_activate (object source,
> EventArgs args)
>         {
>             dialog2 = new Dialog("About", window1,
> Gtk.DialogFlags.DestroyWithParent);
>             dialog2.Modal = true;
>             dialog2.AddButton ("gtk-close",
> ResponseType.Close);          	
>             dialog2.Run ();
>             dialog2.Destroy ();
>         }
>        
>         public void on_dialog1_delete_event (object
> o, DeleteEventArgs args) 
>         {
>             dialog1.Destroy ();
>         }
>         
>         
>         void on_closebutton1_clicked (object source,
> EventArgs args)
>         {
>             dialog1.Destroy ();
>         }
> }
> 
>
-----------------------------------------------------------
> about_dialog.glade
>
-----------------------------------------------------------
> 
> <?xml version="1.0" standalone="no"?> <!--*- mode:
> xml -*-->
> <!DOCTYPE glade-interface SYSTEM
> "http://glade.gnome.org/glade-2.0.dtd">
> 
> <glade-interface>
> 
> <requires lib="gnome"/>
> 
> <widget class="GtkDialog" id="dialog1">
>   <property name="visible">True</property>
>   <property name="title"
> translatable="yes">About</property>
>   <property name="type">GTK_WINDOW_POPUP</property>
>   <property
> name="window_position">GTK_WIN_POS_NONE</property>
>   <property name="modal">True</property>
>   <property name="resizable">False</property>
>   <property
> name="destroy_with_parent">True</property>
>   <property name="decorated">True</property>
>   <property
> name="skip_taskbar_hint">False</property>
>   <property name="skip_pager_hint">False</property>
>   <property
>
name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
>   <property
> name="gravity">GDK_GRAVITY_NORTH_WEST</property>
>   <property name="has_separator">True</property>
>   <signal name="delete_event"
> handler="on_dialog1_delete_event"
> last_modification_time="Mon, 25 Oct 2004 18:13:08
> GMT"/>
> 
>   <child internal-child="vbox">
>     <widget class="GtkVBox" id="dialog-vbox1">
>       <property name="visible">True</property>
>       <property name="homogeneous">False</property>
>       <property name="spacing">0</property>
> 
>       <child internal-child="action_area">
> 	<widget class="GtkHButtonBox"
> id="dialog-action_area1">
> 	  <property name="visible">True</property>
> 	  <property
>
name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
> 
> 	  <child>
> 	    <widget class="GtkButton" id="closebutton1">
> 	      <property name="visible">True</property>
> 	      <property name="can_default">True</property>
> 	      <property name="can_focus">True</property>
> 	      <property name="label">gtk-close</property>
> 	      <property name="use_stock">True</property>
> 	      <property
> name="relief">GTK_RELIEF_NORMAL</property>
> 	      <property
> name="focus_on_click">True</property>
> 	      <property name="response_id">-7</property>
> 	      <signal name="clicked"
> handler="on_closebutton1_clicked"
> last_modification_time="Mon, 25 Oct 2004 18:11:01
> GMT"/>
> 	    </widget>
> 
=== message truncated === 


	
	
		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/