[Gtk-sharp-list] Bug in glade-sharp?
Charles-Louis
charlouis.mono@wanadoo.be
25 Apr 2003 16:20:37 +0200
--=-2FU2xIVj3H826bd+oPUQ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi,
I'm writing an application with glade-2, and my glade file consists of
two widgets: a Gtk.Window window1 and a Gtk.FileSelection
fileselection1.
I have added an 'open' button, where I would like to call the
FileSelector, but when I try to load the FileSelection from the glade
file, I get nothin (null), so when I want to show the fileSelection,I
get this exception:
Unhandled Exception: System.NullReferenceException: A null value was
found where an object instance was required
in <0x0000e> 00 Window.myWindow:OnOuvrir1Activate
(object,System.EventArgs)
in <0x00067> 01 System.MulticastDelegate:invoke_void_object_EventArgs
(object,System.EventArgs)
in <0x00164> 00 GtkSharp.voidObjectSignal:voidObjectCallback
(intptr,int)
in <0x00026> 05 GtkSharp.voidObjectSignal:voidObjectCallback
(intptr,int)
in (unmanaged) 06 Gtk.Application:gtk_main ()
in <0x00004> 06 Gtk.Application:gtk_main ()
in <0x000d9> 00 Window.myWindow:.ctor ()
in <0x0002c> 00 Window.myWindow:Main (string[])
However, when I construct my FileSelection Dialog without glade, the
dialog shows correctly.
Does anyone here have an idea?
--
Charles-Louis <charlouis.mono@wanadoo.be>
--=-2FU2xIVj3H826bd+oPUQ
Content-Disposition: attachment; filename=windowtest.glade
Content-Type: text/plain; name=windowtest.glade; charset=UTF-8
Content-Transfer-Encoding: 7bit
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<signal name="delete_event" handler="OnWindow1DeleteEvent" last_modification_time="Fri, 25 Apr 2003 14:02:53 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Fichier</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu1">
<child>
<widget class="GtkImageMenuItem" id="ouvrir1">
<property name="visible">True</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
<signal name="activate" handler="OnOuvrir1Activate" last_modification_time="Fri, 25 Apr 2003 13:42:23 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="treeview1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="statusbar1">
<property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkFileSelection" id="fileselection1">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Choisir un fichier</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="show_fileops">True</property>
<child internal-child="cancel_button">
<widget class="GtkButton" id="cancel_button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</child>
<child internal-child="ok_button">
<widget class="GtkButton" id="ok_button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</child>
</widget>
</glade-interface>
--=-2FU2xIVj3H826bd+oPUQ
Content-Disposition: attachment; filename=Window.cs
Content-Type: text/plain; name=Window.cs; charset=UTF-8
Content-Transfer-Encoding: 7bit
using System;
using Gtk;
using Glade;
using GtkSharp;
using GladeSharp;
namespace Window{
public class myWindow{
Glade.XML gxml;
[Glade.Widget]
Gtk.Window window1;
[Glade.Widget]
Gtk.FileSelection fs;
public myWindow()
{
Application.Init();
gxml = new Glade.XML("windowtest.glade","window1",null);
gxml.Autoconnect(this);
window1 = gxml.GetWidget("window1") as Gtk.Window;
window1.Title = "My fileSelectionTest";
Application.Run();
}
private void Quit()
{
Application.Quit();
}
#region EventHandlers
private void OnOuvrir1Activate(object o, EventArgs args)
{
// fs = gxml.GetWidget("fileselection1") as Gtk.FileSelection;
fs = new Gtk.FileSelection("Test");
fs.Show();
}
private void OnWindow1DeleteEvent(object o, DeleteEventArgs args)
{
this.Quit();
}
#endregion
private static void Main(string[] args)
{
myWindow w = new myWindow();
}
}
}
--=-2FU2xIVj3H826bd+oPUQ--