[Gtk-sharp-list] Problems compiling with gtk-sharp 0.9

Jorge De Gante Tellez jdegante@linuxware.com.mx
13 May 2003 15:02:19 -0500


--=-+38/o0qjXwQhugnvnI3j
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi

I've upgraded to mono 0.24 and gtk-sharp 0.9. The problem is that when I
try to compile my programs the following error appears multiple times:

error CS0246: Could not find attribute 'GladeWidget' (are you missing a
using directive or an assembly reference ?

In my programs I declare widget variables to work with the controls of
my glade file with a line that says:

[GladeWidget]

I attach a sample source file and a Makefile file.

Thanks in advance.


-- 
Jorge De Gante Tellez
jdegante@linuxware.com.mx
LinuxWare S.A. de C.V.
http://www.linuxware.com.mx
Tel. 26-03-15-15 26-03-15-16 26-03-15-17 
Fax 26-03-15-18

--=-+38/o0qjXwQhugnvnI3j
Content-Disposition: attachment; filename=Makefile.Almacenes
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-makefile; name=Makefile.Almacenes; charset=ISO-8859-1

MCS =3D mcs
RESOURCES =3D /resource:./almacenes/catalmacenes.glade,catalmacenes.glade /=
resource:./almacenes/editalmacen.glade,editalmacen.glade /resource:./ayuda/=
ayuda.glade,ayuda.glade
REFERENCES =3D -r gnome-sharp -r gtk-sharp -r glib-sharp -r glade-sharp -r =
gdk-sharp -r System.Data -r ByteFX.Data
SOURCES =3D main.cs oseis.cs catalogo.cs almacenes/almacen.cs almacenes/edi=
talmacen.cs almacenes/catalmacenes.cs ayuda/ayuda.cs

all: almacenes.exe

almacenes.exe: $(SOURCES)
	$(MCS) -g $(RESOURCES) -o $@ $(SOURCES) $(REFERENCES)

clean:
	-rm almacenes.exe =20


--=-+38/o0qjXwQhugnvnI3j
Content-Disposition: attachment; filename=catalmacenes.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=catalmacenes.cs; charset=ISO-8859-1

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US=
A.
// LinuxWare S.A. de C.V. www.linuxware.com.mx M=E9xico
// Sistema: Open Source Enterprise Information System
// M=F3dulo: catalmacenes.cs -> Cat=E1logo de Almacenes.
// Versi=F3n: 0.1
// Autor: Jorge De Gante T=E9llez <jdegante@linuxware.com.mx>
// Fecha Modificaci=F3n: Martes 4 de Marzo 2003

namespace Oseis {
namespace Almacenes {

	using System;
	using Gtk;
	using Gdk;
	using GLib;
	using Gnome;
	using Glade;
	using GtkSharp;
	using System.Data;
	using ByteFX.Data.MySQLClient;
	using Oseis.Ayuda;

	public class CatAlmacenes {

		Glade.XML ui;
		[GladeWidget]
		Gtk.Window win_catalogo;

		[GladeWidget]
		Gtk.TreeView tree_catalogo;
        [GladeWidget]
		Gtk.Statusbar statusbar1;
	=09
		Dialog dialog;
	=09
		ListStore store;
	=09
		IDbConnection dbcon;
		IDbCommand dbcmd;
		IDataReader reader;
	=09

		public CatAlmacenes()
		{
			dbcon =3D Globals.dbcon;
			Application.Init();
			ui =3D new Glade.XML ("almacenes/catalmacenes.glade", "win_catalogo", nu=
ll);
			ui.Autoconnect (this);
			win_catalogo.Title =3D Mensajes.Catalogo("almacenes");
			TreeViewColumn col_almacen =3D new TreeViewColumn();
			CellRenderer ren_almacen =3D new CellRendererText();
			col_almacen.PackStart(ren_almacen, true);
			col_almacen.AddAttribute(ren_almacen, "text", 0);
            col_almacen.Title =3D "Nombre del almac=E9n";
			tree_catalogo.AppendColumn(col_almacen);
			TreeViewColumn col_tel_almacen =3D new TreeViewColumn();
			CellRenderer ren_tel_almacen =3D new CellRendererText();
			col_tel_almacen.PackStart(ren_tel_almacen, true);
			col_tel_almacen.AddAttribute(ren_tel_almacen, "text", 1);
	        col_tel_almacen.Title =3D "Tel=E9fono";
			tree_catalogo.AppendColumn(col_tel_almacen);
			tree_catalogo.GrabFocus();
			Actualizar();
//			win_catalogo.ShowAll();
			Application.Run();
		}

=09
		public void Actualizar()
		{
			if (tree_catalogo.Model =3D=3D null)
				{
					store =3D new ListStore((int)TypeFundamentals.TypeString, (int)TypeFun=
damentals.TypeString, (int)TypeFundamentals.TypeString);
					tree_catalogo.Model =3D store;
				}=09
			else
				{
					store =3D (ListStore) tree_catalogo.Model;
					store.Clear(); //Si ya fue creada la lista la limpiamos
				}
			string sql =3D "SELECT id_almacen, almacen, telefono FROM almacen ORDER =
BY almacen";
			dbcmd =3D dbcon.CreateCommand();
            dbcmd.CommandText =3D sql;
            try
				{
					reader =3D dbcmd.ExecuteReader();
				}
			catch (Exception ex)
				{
					MessageDialog d =3D new MessageDialog (null, 0, MessageType.Error, But=
tonsType.Ok,Mensajes.ErrorConsultar(ex.Message));
					d.Run();
					d.Destroy();
					throw ex;
				}
			int counter =3D 0;
			while (reader.Read())=20
				{
	                TreeIter iter =3D new TreeIter();
    	            store.Append(out iter);
					GLib.Value almacen =3D new GLib.Value(Convert.ToString(reader["almacen=
"]));
					store.SetValue(iter, 0, almacen);
					GLib.Value telefono =3D new GLib.Value(Convert.ToString(reader["telefo=
no"]));
					store.SetValue(iter, 1, telefono);
					GLib.Value id_almacen =3D new GLib.Value(Convert.ToString(reader["id_a=
lmacen"]));
					store.SetValue(iter, 2, id_almacen);
					counter++;
				}
			string almacenes =3D counter =3D=3D 1 ? " almac=E9n" : " almacenes";
			statusbar1.Push(1, Mensajes.Encontrados(counter, almacenes));
		}
	=09
		private string GetSelectedId()
        {
    		GLib.Value id_almacen =3D new GLib.Value();
			TreeIter iter =3D new TreeIter();
			TreeModel model;
            string str_id_almacen =3D "";
			if (tree_catalogo.Selection.GetSelected(out model, ref iter))
				{
					model.GetValue(iter, 2, id_almacen);
                	str_id_almacen =3D (string) id_almacen;
				}
			else
				{
					MessageDialog d =3D new MessageDialog (null, 0, MessageType.Warning, B=
uttonsType.Ok,Mensajes.SeleccionarUn("almac=E9n"));
					d.Run();
					d.Destroy();
					tree_catalogo.GrabFocus();
				}
            return str_id_almacen;
        }
       =20
		private void on_win_catalogo_delete_event(object o, DeleteEventArgs args)
        {
                Application.Quit();
                args.RetVal =3D true;
        }
       =20
        private void on_but_nuevo_clicked(object o, EventArgs args)
        {
			EditAlmacen edit =3D new EditAlmacen("", this);
        }
	=09
        private void on_but_abrir_clicked(object o, EventArgs args)
        {
            string id_almacen =3D GetSelectedId();
			if (id_almacen !=3D "")=20
				{
					EditAlmacen edit =3D new EditAlmacen(id_almacen, this);
				}=20
        }


        private void on_but_borrar_clicked(object o, EventArgs args)
        {
			string id_almacen =3D GetSelectedId();
			if (id_almacen !=3D "")
				{ 		=09
					MessageDialog d =3D new MessageDialog (null, 0, MessageType.Question, =
ButtonsType.YesNo,Mensajes.BorrarEl("almac=E9n"));
					int result =3D d.Run();
					d.Destroy();
					if ((Gtk.ResponseType)result =3D=3D ResponseType.Yes)
						{
							Almacen almacen 	=3D new Almacen();
							try
								{
									almacen.Find(Convert.ToInt32(id_almacen));
									try
										{
											almacen.Delete();
											MessageDialog d2 =3D new MessageDialog (null, 0, MessageType.Inf=
o, ButtonsType.Ok,
																				Mensajes.Borrado("almac=E9n"));
											d2.Run();
											d2.Destroy();
											Actualizar();
										}
									catch (Exception ex)
										{
											MessageDialog d1 =3D new MessageDialog (null, 0, MessageType.Err=
or, ButtonsType.Ok,
																				Mensajes.ErrorBorrar("almac=E9n", ex.Message));
											d1.Run();
											d1.Destroy();
										}
								}
							catch (Exception ex)
								{
									MessageDialog d3 =3D new MessageDialog (null, 0, MessageType.Error=
, ButtonsType.Ok,
											Mensajes.ErrorBuscar("almac=E9n", ex.Message));
											d3.Run();
											d3.Destroy();=09
								}
							=09
=09
						}
				}
		}


        private void on_but_informacion_clicked(object o, EventArgs args)
        {
			string id_almacen =3D GetSelectedId();
			if (id_almacen !=3D "")=20
				{
					Almacen almacen =3D new Almacen();
					try=20
						{
							almacen.FindRelation(Convert.ToInt32(id_almacen));
							Informacion info =3D new Informacion("almac=E9n", almacen.GenEtiquet=
as(), almacen.GenDatos());
							info.Show();
						}
					catch (Exception ex)
						{
							MessageDialog d =3D new MessageDialog (null, 0, MessageType.Error, B=
uttonsType.Ok,
															Mensajes.ErrorConsultar(ex.Message));
							d.Run();
							d.Destroy();
						}
				}
        }
	=09
        private void on_but_actualizar_clicked(object o, EventArgs args)
        {
			Actualizar();
        }

        private void on_but_cerrar_clicked(object o, EventArgs args)
        {
			Application.Quit();=09
        }
	=09
        private void on_but_ayuda_clicked(object o, EventArgs args)
        {
         	WinAyuda ayuda =3D new WinAyuda("catalmacenes");=20
        }
 =20
	}

}

}

--=-+38/o0qjXwQhugnvnI3j--