[Glade-users] Help needed..

Dear Friends,

I have a problem with my program. I have a window and a dialog box in my
program. The dialog box has a 'Ok' and 'Cancel' button. The window has just
a 'Textbox' . I want to print a message in the textbox when I click the 'Ok'
button in the dialog box. How do I do it?

thanks in advance,


    this was the frist problem I tried to solve with glade ( just one week
ago ;-p ). First of all I set a signal handler for the Button.
Select the signal tab in the Property view of the button. Add the "clicked"
signal and
let Glade generate the code. Now you can find in callback.c a function like

on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)

You have to get the pointer to the entry widget. (look at the FAQ list of
Glade 4.5) then you have to call
gtk_entry_set_text() (look at the GTKJ documentation at
http://www.gtk.org/ )

This was my solution:

on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
  GtkWidget *entry1;

  entry1 = lookup_widget (GTK_WIDGET (button), "entry1");

  gtk_entry_set_text(GTK_ENTRY(entry1),_("Button1 Clicked"));

I'm sorry for my english, I hope you can understand me... ;-))


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