Re: Message box

Alf C Stockton ha scritto lo scorso 30/05/04 19.05:
I am sure that there must be an equivalent of the MS MessageBox in GTK+ but
after a bit of looking I have not found it.
What I want is something to display an error message for as long as it takes for
the user to respond.

Here is a code snippet using the gtk_message_dialog_new:

        GtkWidget * dlg,
                  * owner;
        gchar     * text;
        gint        resp;

        /* pointer to owner window */
        owner = lookup_widget (GTK_WIDGET (button), "window1");
        /* Initialize the messagedialog */                                      
dlg = gtk_message_dialog_new (GTK_WINDOW (owner), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, "May I perform '%s'?", text);
        /*Here is the msgdialog
        resp = gtk_dialog_run (GTK_DIALOG (dlg));
        /* Which is the response?
        switch (resp) {
                case (GTK_RESPONSE_YES):
                /* Pulsante "YES" */
                /* Perform your YES operation here */
                case (GTK_RESPONSE_NO):
                /* Pulsante "NO" */
                /* Perform your NO operation here */
                /* No response */
        /* When done destroy the msgdialog */
        gtk_widget_destroy (dlg);

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