[Glade-users] Text entries & re-using msg boxes




 yo might want to use a GtkDialog ( or a Modal window.) Using GtkDialog, you
can call gtk_dialog_run() (?) a and present the user with th interface you want
inside the dialog.

  Then you wait for the callback on the button of the dialog and on the
callback you capture the entries.

  Take a look at GtkDialog docs.

  Hope this helps.

Harring
--- Manu C S <manu sumerusolutions com> wrote:
Hi,

Sorry if this is too trivial for the list.
I have the following 2 problems that I couldn't solve 
(atleast, not elegantly!)

1.) 

    I have a button which on being pressed will execute
    a command. For the command to be executed I need some
    inputs from the user. So in the callback to the button,
    I'm gtk_widget_showing() the interface to get the inputs.
    But the user inputs (which is via a text entry) can only
    be got in _its_ callback.


        /* call back for the button */
void
on_tw_gsk_button_clicked (GtkButton *button,
                          gpointer  user_data)
{
    GtkWidget* get_param_window = create_get_param_window();
    gtk_widget_show(get_param_window);
    return;
}

    /* call back for the user inputs */
void
on_param_window_ok_clicked (GtkButton *button,
                            gpointer    user_data)
{
    GtkWidget* entry = lookup_widget(GTK_WIDGET(button), "tw_sk_pp_entry");
    gchar* passphrase = gtk_entry_get_text(GTK_ENTRY(entry));

    /* since I get the user inputs here,
     * I'm executing my back-end command here
     */
}


Is it possible for me to somehow wait for user input and
then execute the command in the first function itself?
I want to be able to re-use the get_param_window in several
places; so I don't want to execute any specific back-end
command in its callback.
What I have in mind is:

void
on_tw_gsk_button_clicked (GtkButton *button,
                          gpointer  user_data)
{
        /* show get_param_window here */

        if user has typed something
            then execute command here
}

char*
on_get_param_window_ok_clicked (GtkButton *button,
                                gpointer    user_data)
{
    return text entered by user
}



2.) Is it possible to have gnome-message boxes generate
    dynamically created error messages?
    From what I could see, the msg box is created with a
    gnome_message_box_new("message", ...) where the message
    is passed to the ctor.
    I want to have a single msg box and use it with different
    run-time-generated error messages. 

Thanks,
Manu

_______________________________________________
Glade-users maillist  -  Glade-users lists ximian com
http://lists.ximian.com/mailman/listinfo/glade-users


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/




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