Re: combo and button-press-event




  Manel,

 Try this instead.:

  g_signal_connect(G_OBJECT(GTK_COMBO(combo)->entry), "activate",
                            G_CALLBACK(callback), NULL);

Good luck.

Harring.

--- Manel de la Rosa <manel comp racclub net> wrote:
Hello, 

Anybody knows how have I to modify the GtkCombo widget (or any VBox/HBox 
descendant widget containing an entry) code to make it answer a 
"button_press_event" ?

I mean, if I connect a GtkCombo widget to a given callback and I click on 
it, I get no answer, the callback is not executed. For example,
here there is a very short program (25 lines counting blanks) that
tries to print a message:

------------------------------- CUT HERE ----------------------------------
#include <gtk/gtk.h>

void callback(GtkWidget *widget, gpointer data)
{
  g_warning("any message\n");
}

int main (int argc, char *argv[])
{
  GtkWidget *shell;
  GtkWidget *combo;

  gtk_init (&argc, &argv);
  shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(shell), "title");
  
  combo = gtk_combo_new();
  gtk_container_add(GTK_CONTAINER(shell), combo);
  g_signal_connect(G_OBJECT(combo), "button-press-event",
                   G_CALLBACK(callback), NULL);
  
  gtk_widget_show_all(shell);
  gtk_main ();

  return 0;
}
------------------------------- CUT HERE ----------------------------------


And nothing happens! I've looked at the widget's code and a
"gtk_combo_button_press()" exists, but is only connected to combo->popwin,
and it really does nothing aside to popdown the combo list. I've added a
EventBox widget but this fails too.

Please, I'm developing an app that uses button clicks on entries to invoke 
certain actions, and I need to do it on a GtkCombo and a home-made VBox 
descendant widget and I cannot use neither of them because this problem.
I'm desesperate, so I'd apreciate *greatly* any kind of help.

Thank you in advance
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



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