Re: [gtk-list] Re: opening modal windows from the "button-press-event"handler forclist
- From: Vlad Harchev <hvv hippo ru>
- cc: gtk-list redhat com
- Subject: Re: [gtk-list] Re: opening modal windows from the "button-press-event"handler forclist
- Date: Tue, 15 Feb 2000 12:23:49 +0400 (SAMT)
On Tue, 15 Feb 2000 xiang@mei.com.cn wrote:
> 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.
> *************************************************************************/
> };
The version of this function you propose won't show anything (ie empty
window) when called from that signal handler, and the window won't accept any
other messages at all, though X server won't be "locked". But of course it
works fine when called from somewhere else).
Best regards,
-Vlad
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]