Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ttk::entry selection command seems to have no effect

58 views
Skip to first unread message

andrej.m...@gmail.com

unread,
Oct 16, 2013, 5:30:00 PM10/16/13
to
Hi,

Testing the following script:

-----
package require Tk

ttk::entry .e
pack .e

.e insert 0 "foobar"
.e selection range 0 end
-----

The selection is still empty after the last command. What am I doing wrong?

Christian Gollwitzer

unread,
Oct 17, 2013, 2:16:07 AM10/17/13
to
Am 16.10.13 23:30, schrieb andrej.m...@gmail.com:
> -----
> package require Tk
>
> ttk::entry .e
> pack .e
>
> .e insert 0 "foobar"
try "update" here
> .e selection range 0 end
> -----
>
> The selection is still empty after the last command. What am I doing wrong?
>

It works on Tk/Aqua. Which platform? Does it work, when you insert an
"update" as indicated above?

Christian

Arjen Markus

unread,
Oct 17, 2013, 3:38:28 AM10/17/13
to
On Thursday, October 17, 2013 8:16:07 AM UTC+2, Christian Gollwitzer wrote:

> > The selection is still empty after the last command. What am I doing wrong?

> It works on Tk/Aqua. Which platform? Does it work, when you insert an
> "update" as indicated above?
>

I can confirm that on Windows there is no visual selection. Not even if I insert an "update" command or put the selection in an after event.

This is both with the classical entry widget and the themed one.

Regards,

Arjen

Christian Gollwitzer

unread,
Oct 17, 2013, 3:47:48 AM10/17/13
to
Am 17.10.13 09:38, schrieb Arjen Markus:
It might interfere with the clipboard. Try:

-----
package require Tk

ttk::entry .e -exportselection false
pack .e

.e insert 0 "foobar"
.e selection range 0 end
-----

Christian

Arjen Markus

unread,
Oct 17, 2013, 4:00:55 AM10/17/13
to
On Thursday, October 17, 2013 9:47:48 AM UTC+2, Christian Gollwitzer wrote:

> It might interfere with the clipboard. Try:

>
> ttk::entry .e -exportselection false
>

No, that doesn't have any visual effect either.

Regards,

Arjen

Christian Gollwitzer

unread,
Oct 17, 2013, 4:08:31 AM10/17/13
to
Am 17.10.13 10:00, schrieb Arjen Markus:
Another thing popped up: Are you using 8.6.1 or 8.6.0? There was a fix
recently with selection in a combobox where only part of the string was
shown. What does

.e selection present
selection get

tell?

Christian

Arjen Markus

unread,
Oct 17, 2013, 4:43:44 AM10/17/13
to
On Thursday, October 17, 2013 10:08:31 AM UTC+2, Christian Gollwitzer wrote:

>
> Another thing popped up: Are you using 8.6.1 or 8.6.0? There was a fix
> recently with selection in a combobox where only part of the string was
> shown. What does
>
> .e selection present
> selection get
>
> tell?

I am using Tcl/Tk 8.6.0. [selection get] gives:

PRIMARY selection doesn't exist or form "STRING" not defined

It may indeed be time to update :).

Regards,

Arjen

nemethi

unread,
Oct 17, 2013, 10:15:18 AM10/17/13
to
The "selection range" command works as expected on all platforms. The
default binding scripts make heavy use of it, and one can select any
text range in a Tk core entry or ttk::entry widget with the mouse and
the keyboard, which would not be true if the command didn't work.

However, *on Windows* (only) the selection will only become visible when
the entry gets the focus. If you just type in the commands from within
an interactive wish session then the entry won't yet have the focus. By
clicking the task bar of the Wish window, the entry will get the focus
(if it is the only widget of the window, like in the simple example
discussed in this thread) and the selection will become visible. By
activating any other top-level window, the selection will become
invisible again.

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

0 new messages