[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to get the widget type



	Thanks a lot, I actually did something like:

	if ( strcmp("GtkCList", gtk_type_name(GTK_WIDGET_TYPE( clist ))) == 0 )
	   /* Then is a list */
	else
	  /* any other stuff */

	Now my only doubt is what about the entry widget (I did
	write an e-mail to the list but nobody has answer me)
	I want to know if the widgets * I got with gtk_entry_new()
	are lost when the fcn they're obtained ends.

	I attached the problem code in the last mail, but the whole
	point is essentially resumed in these points:

	1.- I get memory with g_malloc for a struct containing 2 arrays:
	    one for widget pointers and the other for integers (both are
	    8 items size).

	2.- Other fcn (which is passed the struct * recently obtained)
	    makes the 8 pointers gtk_entries pointers with
	    mystruct->arr[0] = gtk_entry_new();
	    /* ... some code for the other 7 entries ... */
	3.- Set the callbacks for the entries (e.g., 'mycallback')
	4.- The whole thing is packed into a table and is showed in a
	    window.

	5.- The 'mycallback' callback receives the struct of entries
	    g_malloc'ed and sends them to another function to see if
	    there is a text entered by the user into the entries.

	6.- When the analizer function tries to look into the entries
	    the program crashes,  suppossedly because of a segmentation
	    fault at the time of the access:

	   /* Tryies to get the pointer (of the entry) the first array 
	      item is pointed to */
	    GtkWidget *mywidget = mystruct->arr[0];



	 This is what I don't get it...
	 I think the memory block I'm trying to access is perfectly
	 valid.  I got it from g_malloc, then the pointers are assigned
	 from a call to gtk_entry_new(), so... What am I doing wrong???

	 Excuse me if the mail is too long but, I have to make this thing
	 to work propoerly before next tuesday and I just don't know
	 what to do.

	 thanks in advance for your support.
	 regards.

Si la memoria no me es infiel, eran aproximadamente:
	Las 09 horas con 38 minutos y 25 segundos del 07 de Dec del 2000
Cuando Havoc Pennington osó irrumpir mi descanso para decir:
> 
> MC_Vai <estoy@ver.megared.net.mx> writes:
> > 	How can I get to know the type of a widget.
> > 
> > 	I've been trying with gtk_widget_get_type but this
> > 	returns a non-sense value, because of I am not allowed
> > 	to specify the widget I want to know the type (as an
> > 	argument).
> > 
> > 	Thanks in advance for your support.
> 
> GTK_OBJECT_TYPE (widget) will work.
> 
> gtk_widget_get_type() returns the type code for GtkWidget.
> 
> Havoc





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]