Re: Widget returning NULL?



Harring Figueiredo wrote:

With this information is impossible to know what you are doing wrong -- or
trying to do.
Please, if possible, send a code snip to the list.

Harring.
--- Steve & Patti Getzinger <psatg bluemarble net> wrote:
I am at a loss here. I have 3 entries I am testing in a func and two of them are NULL:

if(entry2==NULL)

How does it end up NULL and how do I unnulify it? I wish to test on text length but can not get past this NULL issue. The second and third come back NULL and the first always comes back not NULL using the above test regardless of data entered.

TIA,
Steve

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Here is how they are defined.

 GtkWidget *entry20;
 GtkWidget *entry22;
 GtkWidget *entry23;

Here is the portion that builds them.

 entry20 = gtk_entry_new ();
 gtk_widget_show (entry20);
 gtk_table_attach (GTK_TABLE (table2), entry20, 2, 3, 1, 2,
                   (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                   (GtkAttachOptions) (0), 0, 0);
 gtk_widget_set_usize (entry20, 208, 24);

 entry22 = gtk_entry_new ();
 gtk_widget_show (entry22);
 gtk_table_attach (GTK_TABLE (table3), entry22, 1, 2, 1, 2,
                   (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                   (GtkAttachOptions) (0), 0, 0);

 entry23 = gtk_entry_new ();
 gtk_widget_show (entry23);
 gtk_table_attach (GTK_TABLE (table3), entry23, 1, 2, 2, 3,
                   (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                   (GtkAttachOptions) (0), 0, 0);
 gtk_entry_set_visibility (GTK_ENTRY (entry23), FALSE);

Signal Connects

gtk_signal_connect (GTK_OBJECT (entry20), "changed",
                     GTK_SIGNAL_FUNC (on_entry20_changed),
                     NULL);
 gtk_signal_connect (GTK_OBJECT (entry22), "changed",
                     GTK_SIGNAL_FUNC (on_entry20_changed),
                     NULL);
 gtk_signal_connect (GTK_OBJECT (entry23), "changed",
                     GTK_SIGNAL_FUNC (on_entry20_changed),
                     NULL);

Callback

void
on_entry20_changed                (GtkEditable     *editable,
                                       gpointer         user_data)
{
 if(entry20 == NULL)
   {
       g_warning("entry20 is NULL");
   }else{
       g_warning("entry20 is not NULL");
  }
  if(entry22 == NULL)
   {
       g_warning("entry22 is NULL");
   }else{
       g_warning("entry22 is not NULL");
   }
 if(entry23 == NULL)
   {
       g_warning("entry23 is NULL");
   }else{
       g_warning("entry23 is not NULL");
   }

/*
if(strlen(gtk_editable_get_chars(GTK_EDITABLE(entry20),0,-1)) > 6)
               {
                 gtk_widget_set_sensitive (button19, TRUE);
   }else{
               gtk_widget_set_sensitive (button19, FALSE);
        }
*/
}

The vars used are global. The commented out if is what I want to do but test all three entries for sensitivity. Works fine if I am only testing entry20 but as soon as I try to add another it fails to operate as expected. I put in the test for NULL and entry22 and 23 always return NULL.

TIA
Steve




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