Re: [gtk-list] opening modal windows from the "button-press-event" handler forclist
- From: xiang mei com cn
- To: <gtk-list redhat com>
- Subject: Re: [gtk-list] opening modal windows from the "button-press-event" handler forclist
- Date: Tue, 15 Feb 2000 09:19:15 +0800
I will modify the error_message() like this:
void error_message(const char* title,const char* text)
{
GtkWidget *dialog;
GtkWidget *button,*hb,*l;
char* str;
dialog = gtk_dialog_new();
gtk_window_set_title (GTK_WINDOW (dialog), title);
l = gtk_label_new(text);
hb = gtk_hbox_new(1,0);
gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 43);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
hb, TRUE, TRUE, 0);
button = gtk_button_new_with_label("OK");
// ???
gtk_signal_connect_object(GTK_OBJECT(button),"clicked",
GTK_SIGNAL_FUNC(gtk_main_quit),GTK_OBJECT(dialog));
/**********************************************************************
This signal connect is wrong, it should be like this:
gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog));
***********************************************************************/
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
button, TRUE, TRUE, 0);
gtk_window_set_modal (GTK_WINDOW(dialog),TRUE);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show_all(dialog);
// ???
gtk_main();
gtk_window_set_modal (GTK_WINDOW(dialog),0);
gtk_widget_destroy(dialog);
/*************************************************************************
There is no need to do these, just delete them. because
when you click button OK, the signal "clicked" connected to
it will destroy the dialog.
*************************************************************************/
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]