gtk2: Uneditable Texts in Entries/TextViews



I need to create a text entry with a mix of editable and uneditable
text.  An example might illustrate better:

The user is presented with an entry that looks like:

[little green truck]

and can edit '(red)' freely but canoot affect 'little' or 'truck' - he
can edit the entry to yield [little white truck], [little red truck],
[little yellow truck], even [little  truck], but not [little green car]
or [big green truck] or [my little green truck].

I only want a single line worth of text, so I'd much prefer to use use a
GtkEntry.  Nonetheless, I'm willing to use a GtkTextView if necessary -
I've found I can almost do what i want by tagging text with
editable=FALSE tags; the problem is (using the above example) if I tag
the span from position 0 to position six, I can still insert in front of
the existing text, i.e. I can enter [my little green truck].

Hints and suggestions would be appreciated.  I'd prefer not to, but if I
have to resort to signal catching I'd appreciate pointers on the idiom
for heading off sample widget behavior.  I'm actually using pygtk, but
that list is very quiet and plus I don't think there is any particularly
python specific about this issue.

Thanks,
Jay



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