RE: dialog widget problem



Since were on the topic.  Actually that did not work at all.  I get a core 
dump when I do this.  The OK button stays depressed.  Maybe since I am 
doing a showall from another function, main does not know what objects were 
set to show_all.  Need to investiage further.



-----Original Message-----
From:	Maher Awamy [SMTP:muhri muhri net]
Sent:	Monday, October 30, 2000 5:22 PM
To:	Matt Eisemann; gtk-list gnome org
Subject:	Re: dialog widget problem


On Mon, 30 Oct 2000 17:09:35 -0500, Matt Eisemann said:

> Currently I am creating an application, but there is something wrong with 
>  the callback that hides the widget or something is wrong in my logic. 
 Here
>  is a bit of code below which so should give some idea of what I am 
doing.
>   The main window calls a dialog box when a certain flag is set.  I want 
the
>  user to be able to push the "OK" button and hide the dialog window and
>  reset the flag back to FALSE.  I hopefully left out extraneous 
information
>  and code.
>
>  void some_function(... )
>  {
>
>    .....
>
>
>
>    if(tasks->dead_tasks == TRUE)
>    {
>      gtk_widget_show_all(tasks->dialog_win);
>      tasks->dead_tasks = FALSE;
>    }
>  }
>
>
>
>  int main(INT argc, CHAR *argv[])
>  {
>    ...
>    dialog_win = gtk_dialog_new();
>    dialog_label = gtk_label_new("WARNING.  There is something wrong.  ");
>    dialog_ok = gtk_button_new_with_label("OK");
>    gtk_window_set_title(GTK_WINDOW(dialog_win),"dead tasks");
>
>   gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_win)->vbox),dialog_label,F 
>  ALSE,FALSE,NO_PADDING);
>    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_win)->action_area),dialog 
>  _ok, FALSE,FALSE, NO_PADDING);
>
>    gtk_signal_connect(GTK_OBJECT(dialog_ok),"clicked",
>
>                                GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJEC 
>  T(dialog_win));

here you are calling the hide on the ok button itself - not the dialog, 
since
the signal_func passes the widget also .. one way you could remedy this is

gtk_signal_connect(GTK_OBJECT(dialog_ok), "clicked",
GTK_SIGNAL_FUNC(hide_dialog), dialog_win);

void hide_dialog(GtkWidget *button, GtkWidget *dialog_win)
{
	gtk_widget_hide(dialog_win);
	return;
}

Maher


>   }
>    The code works somewthat above but the problem is that the OK button
>  disappears and not the whole window.
>
>
>  _______________________________________________
>  gtk-list mailing list
>  gtk-list gnome org
>  http://mail.gnome.org/mailman/listinfo/gtk-list
>
>

--
muhri muhri net -- http://www.muhri.net





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