Re: [gtk-list] Yes it's broke.



On Mon, 2 Mar 1998, Leeman Strout wrote:

> 
> Ok here's a snippet that just doesn't work:
> 
> 
> void show_options (GtkWidget *button, gpointer *data)
> { if (GTK_TOGGLE_BUTTON(button)->active) {
>     gtk_widget_show (optionsbox);
>   } else {
>     gtk_widget_hide (optionsbox);
>   }
> }
> 
> And the setup for it elsewhere:
> 
>   button_options = gtk_check_button_new_with_label ("Options");
>   gtk_signal_connect (GTK_OBJECT (button_options), "clicked",
>                       GTK_SIGNAL_FUNC (show_options), NULL);
> 
> And hitting the options button just doesn't do anything in 0.99.4  however
> it does the expected in 0.99.3  =)

hm, i can't reproduce this:

#include <gtk/gtk.h>

static void
print_toggle_button_state (GtkWidget *toggle_button,
                           gpointer   user_data)
{
  g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));

  printf ("togglebutton: active=%d\n", GTK_TOGGLE_BUTTON (toggle_button)->active);
}

int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *button;

  gtk_init (&argc, &argv);
  window =
    gtk_widget_new (gtk_window_get_type (),
                    "GtkWidget::visible", TRUE,
                    NULL);
  button =
    gtk_widget_new (gtk_toggle_button_get_type (),
                    "GtkWidget::visible", TRUE,
                    "GtkButton::label","click me",
                    "GtkWidget::parent", window,
                    "GtkObject::signal::clicked", print_toggle_button_state, NULL,
                    NULL);
  gtk_main ();

  return 0;
}

gives me:
togglebutton: active=1
togglebutton: active=0
togglebutton: active=1

when clicking the toggle button, can u provide a complete test case
if you still believe there is some missbehaviour?



> 
> Leeman
> alaric@ct2.nai.net
> 

---
ciaoTJ



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