Re: Question about gtk_editable_select_region



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.

> 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 ]
 
> 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...
 
> 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. 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.

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

Regards,
                                        Owen




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