Re: how to implement a modal window



Hi Neo,

as far as I understand, this piece of code can used to create an new
window "inside " the main window. is it what you want ?!

void button_click_cb (GtkWindow *button, GPointer *user_pointer) {

        GtkWidget *Dialog = gtk_dialog_new ();
        gtk_widget_set_size_request (Dialog, 240, 320);
        gtk_window_set_title (GTK_WINDOW (Dialog), ("Page Info"));
        gtk_window_set_position (GTK_WINDOW (Dialog), GTK_WIN_POS_CENTER_ON_PARENT);
        gtk_window_set_modal (GTK_WINDOW (Dialog), TRUE);
        gtk_window_set_default_size (GTK_WINDOW (Dialog), 240, 320);
        gtk_window_set_resizable (GTK_WINDOW (Dialog), FALSE);
        gtk_window_set_decorated (GTK_WINDOW (Dialog), TRUE);
        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (Dialog), TRUE);
        gtk_window_set_skip_pager_hint (GTK_WINDOW (Dialog), TRUE);
        gtk_window_set_type_hint (GTK_WINDOW (Dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
        gtk_window_set_gravity (GTK_WINDOW (Dialog), GDK_GRAVITY_NORTH_EAST);
        gtk_window_set_transient_for(GTK_WINDOW(Dialog),
GTK_WINDOW(main_window->topLevelWindow));
 (...)

}

regards

PS: sorry if I do not undestand as you expect :S


On 5/9/05, Neo Liu <Neo Liu sun com> wrote:
Gurus,

I want to implement below behavior

1.main window has a button.
2.when the button is pressed, a new modal window pops up.

However, it seems neither gtk_window_set_modal nor gtk_grab_add does help.

What's the right way to use that? Is there any sample code that I can
refer to?

thanks in advance and best regards,

-- 
Antonio Gomes
E-mail: antonio gomes indt org br
Embedded Linux Lab - 10LE
INdT - Instituto Nokia de Tecnologia (Manaus/Br)
NOKIA's Technology Institute



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