Re: Question about gtk_editable_select_region



On 16 May 2001 08:01:45 -0400, Owen Taylor wrote:
> 
> 
> Damian Ivereigh <damian cisco com> writes:
> 
> > Hi guys,
> > 
> > I have been messing around with gtk_editable_select_region() and it
> > doesn't do quite what I want. What I am trying to do is have a text
> > field which is already selected so that people can just hit the middle
> > mouse button and *replace* whatever is there with the clipboard
> > contents.
> > 
> > Right now if I use this function inside a GtkEntry widget, it blows away
> > anything that is currently stored in the clipboard. 
> 
>  http://www.freedesktop.org/standards/clipboards.txt
> 
> The selection is not the same as the clipboard.

Aha, now I can use the correct terms - that is good info.

> > Yet if I don't use
> > the function and manually select the text (it is now highlighted in a
> > dark reverse), now go and select something else - now the first
> > highlighting is turned into a lighter reverse - I can then click the
> > middle button.
> 
> [ You can also, in GTK+-1.2 get this by right-dragging ]

So you can, I didn't know that!

> > I believe the terms for these conditions are "Selected" (when mouse is
> > dragged over it) and "Active" (when it is still available to be replaced
> > by a single action).
> 
> News to me...

I pinched the terms from the names given to them in the themes gtkrc
file (which set the colours for these states).

> > So in those terms is there a way to say some text is "Active" but not
> > "Selected"?
> 
> You probably can just poke values into editable->selection_start and 
> editable->selection_end and call gtk_widget_queue_redraw().
> 
> I would not advise it.

Yeah, don't really want to go there!

> People should be replacing the current contents
> of an entry by copying to the CLIPBOARD [ gnome-terminal needs to be
> fixed to make this easy ], selecting the contents of the entry, and
> pasting into it with Control-v. Just as they would on any other
> platform.

Yes, I see where your going with this and yes gnome-terminal behaving
better would help a lot.

> GTK+-2.0 gets rid of the "selected but not" state, and right clicking
> pops up a menu (with paste in it).

So what I hear you saying is at that point essentially the PRIMARY
"atom" would just get overwritten (and who cares, because you are just
using the CLIPBOARD atom) whenever you called
gtk_editable_select_region. 
 
Damian





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