[gtk-list] Re: Need help with text entry background



Preben Randhol wrote:
> 
> I have a text entry which I have defined not editable. In order to
> clarify for the user that he cannot edit this value I want to change
> the white background to the normal grey background colour. In this way
> only when the background is white is it editable...

like code forge?

I'd make 2 functions, one to set editable one to set uneditable. in each
of these functions would be the appropriate gtk_text_set_editable()
call, as well as the actual background color change, and maybe something
to realize this?


the code might end up something like this (I didn't test this)

void set_ed(GtkWidget *textbox)
{
        gtk_text_set_editable(GTK_TEXT(textbox),TRUE);
        style->bg[NORMAL]={ /* color in here */ };
        return;
}

void unset_ed(GtkWidget *textbox)
{
        gtk_text_set_editable(GTK_TEXT(textbox),FALSE);
        style->bg[NORMAL]={ /* color in here */ };
        return;
}


it may need gtk_widget_realize(textbox) to work right? I d'no :)

-Erik



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