For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > October 2004 > rotext widget question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author rotext widget question
bob

2004-10-15, 3:57 pm

hello,
what should i do in order to disable text selection (from a mouse)
within a rotext widget ?
insertion is already disabled but i would also like to prevent user from
selecting part of the text.
I tried to unbind Button1-Motion and Button1-ButtonPress but has no effect.
is there a kind of special tag for selected text ?
any clue ?
Thanks
Bob

Richard S Beckett

2004-10-15, 3:57 pm

"bob" <bob@esten.com> wrote in message
news:j9Rbd.32291$hk6.1151907@news20.bellglobal.com...
> hello,
> what should i do in order to disable text selection (from a mouse)
> within a rotext widget ?
> insertion is already disabled but i would also like to prevent user from
> selecting part of the text.
> I tried to unbind Button1-Motion and Button1-ButtonPress but has no

effect.
> is there a kind of special tag for selected text ?
> any clue ?
> Thanks
> Bob


Have a play with the -exportselection => 0 and -state => 'disabled' options,
and let us know if one works, I suspect the former should, but I've never
tried it.

R.


$_@_.%_

2004-10-15, 8:56 pm


"Richard S Beckett" <spikeywan@bigfoot.com> wrote in message-id:
<ckosto$ked$1@newshost.mot.com>
>
>"bob" <bob@esten.com> wrote in message
>news:j9Rbd.32291$hk6.1151907@news20.bellglobal.com...
>effect.
>
>Have a play with the -exportselection => 0 and -state => 'disabled' options,
>and let us know if one works, I suspect the former should, but I've never
>tried it.
>
>R.


I often just make the selectbackground the same as the background and
the selectforeground the same as the foreground, then disable the menu.


bob

2004-10-16, 3:56 am

$_@_.%_ wrote:
> "Richard S Beckett" <spikeywan@bigfoot.com> wrote in message-id:
> <ckosto$ked$1@newshost.mot.com>
>
>
>
> I often just make the selectbackground the same as the background and
> the selectforeground the same as the foreground, then disable the menu.
>
>


Thanks for your replies,
i tried all your suggestions and following are my results:

1 - exportselection => 0 seems to only prevent rotext from exporting a
given selection through usual cut'n paste but does not avoid the visual
effect of selecting a zone nor does it avoid the scrolling of widget
during selection
2 - state => 'disabled' works great but also prevent program from
updating text within the widget. Should work if widget is
enabled/disabled before/after each new update though. May be *the* trick.
3 - choosing same colors for both active and normal
foregrounds/backgrounds indeed disable the visual effect of selecting
text but nevertheless does not prevent text selection from scrolling the
widget.

so i my case (wish both visual effect and scrolling to disappear)
solution 2 should make it.
let me know if you have other great ideas
cheers,
Bob
bob

2004-10-16, 3:56 am

$_@_.%_ wrote:
> "Richard S Beckett" <spikeywan@bigfoot.com> wrote in message-id:
> <ckosto$ked$1@newshost.mot.com>
>
>
>
> I often just make the selectbackground the same as the background and
> the selectforeground the same as the foreground, then disable the menu.
>
>


Thanks for your replies,
i tried all your suggestions and following are my results:

1 - exportselection => 0 seems to only prevent rotext from exporting a
given selection through usual cut'n paste but does not avoid the visual
effect of selecting a zone nor does it avoid the scrolling of widget
during selection
2 - state => 'disabled' works great but also prevent program from
updating text within the widget. Should work if widget is
enabled/disabled before/after each new update though. May be *the* trick.
3 - choosing same colors for both active and normal
foregrounds/backgrounds indeed disable the visual effect of selecting
text but nevertheless does not prevent text selection from scrolling the
widget.

so i my case (wish both visual effect and scrolling to disappear)
solution 2 should make it.
let me know if you have other great ideas
cheers,
Bob
Jack D

2004-10-16, 3:56 pm

"bob" <bob@esten.com> wrote in message
news:j9Rbd.32291$hk6.1151907@news20.bellglobal.com...
> hello,
> what should i do in order to disable text selection (from a mouse)
> within a rotext widget ?
> insertion is already disabled but i would also like to prevent user from
> selecting part of the text.
> I tried to unbind Button1-Motion and Button1-ButtonPress but has no

effect.
> is there a kind of special tag for selected text ?
> any clue ?


Easiest: You can remove "all" bindings by:

$text->bindtags([]);

for a "true" ROText widget.

Harder: Subclass the widget and override all "select" type methods .. you
will have to go through Text.pm to find out all the ones which use the "sel"
tag.

Jack


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com