RE: [gtk-list] Re: Cosmetic problem with GTK_STATE_PRELIGHT



On 20-Dec-97 Guillaume Laurent wrote:
>> I discovered the following problem : I'd like to set a button
>> insensitive after pressing it. (Every time the button is pressed, a
>> list item is deleted. List empty => button should be disabled)
> 
> Just a guess here, but are you connecting the "pressed" event, or the
> "clicked" event ? I had a somewhat similar problem recently because I
> had connected the "pressed" event to a function that would do some
> rather drastic changes to the button so that it would never get the
> "released" event and stay in an awkward state.

No, I'm connecting to "clicked" :

    button = gtk_button_new_with_label ("Delete");
    gtk_signal_connect (GTK_OBJECT(button), "clicked",
                        (GtkSignalFunc) delete_callback,
                        NULL);
and:

    void delete_callback (GtkWidget *widget, gpointer data)
    {
        [..]

        delete_the_item();
        if (number_of_items == 0)
          gtk_widget_set_sensitive (widget, FALSE);

        [..]
    }

Regards,
   Stefan



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