Re: gtk_editable_set_editable not working.



On Thu, Oct 14, 2004 at 02:02:53PM +0200, Jos�ntonio S�hez wrote:
> I'm using gtk 2.4.11 on a Debian unstable system and I've got a problem.
> I made a GUI using glade with anjuta. I want an entry widget to be not
> editable until a button is pressed.
> I checked in glade the editable property to no in the entry widget and
> then added a handler to the clicked signal of the button with the
> following code (on callbacks.c):
> 
> void
> on_boton_clicked               (GtkButton       *button,
>                                         gpointer         user_data)
> {
>         printf("Clicked\n");
> 	GtkWidget *entry = lookup_widget(GTK_WIDGET(button),"entry");
> 	gtk_editable_set_editable(GTK_EDITABLE(entry),TRUE);
> }
> 
> but when I run the program and click on the button I can see the
> clicked message (so the method is executed) but I cannot edit text in
> the entry. Why? Am I doing something wrong?

Hi,

The reason is that glade is using gtk_widget_set_sensitive to set the
widget insensitive. I reproduced your problem and the solution it to
use this code instead to set it sensitive:

  GtkWidget *entry = lookup_widget(GTK_WIDGET(button),"entry");
  gtk_widget_set_sensitive(GTK_WIDGET(entry),TRUE);

-- 
Daniel Nilsson
 



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