Home > Archive > PerlTk > October 2005 > Text Selection Bug in ActiveState W32 Perl?
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 |
Text Selection Bug in ActiveState W32 Perl?
|
|
| Craig M. Votava 2005-09-20, 7:01 pm |
| Folks-
I think I may have found a bug in the ActiveState W32 Perl
(version 5.8.7 build 813 and before). Please help me verify
it if you can.
This seems to work fine on unix boxes (SGIs & Suns), but
doesn't work on Windows XP & 2000 (and maybe others).
To verify:
1.) Run the following program:
use Tk;
my $mw = MainWindow->new;
my $text = $mw->Scrolled('Text', -state=>'disabled')->pack;
$text->configure(-state=>'normal');
$text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
eight\nnine\nten\n");
$text->configure(-state=>'disabled');
$mw->Button(
-text => "enable",
-command => sub{$text->configure(-state=>'normal')} )->pack;
$mw->Button(
-text => "disable",
-command => sub{$text->configure(-state=>'disabled')} )->pack;
MainLoop;
2.) Before hitting any buttons, try selecting some text. For me,
any text that I select is not highlighted (but it is
selected). THIS IS THE BUG!
3.) Now, hit the 'enable' button (hitting disable at this point
doesn't change anything for me). Now select some text. For
me, selected text is now highlighted.
4.) Now, hit the 'disable' button, and select some text. For me,
selected text is still highlighted.
If others see this problem too, then I will submit the bug
to activestate. If others don't see this bug, let me know too;
maybe it's just me...
If anybody has a fix, please let me know!
Thanks
-Craig Votava
Lucent Technologies
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Konovalov, Vadim 2005-09-21, 3:56 am |
| > 1.) Run the following program:
> use Tk;
>
> my $mw = MainWindow->new;
> my $text = $mw->Scrolled('Text', -state=>'disabled')->pack;
>
> $text->configure(-state=>'normal');
> $text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
e
> ight\nnine\nten\n");
> $text->configure(-state=>'disabled');
>
> $mw->Button(
> -text => "enable",
> -command => sub{$text->configure(-state=>'normal')} )->pack;
>
> $mw->Button(
> -text => "disable",
> -command => sub{$text->configure(-state=>'disabled')} )->pack;
>
> MainLoop;
>
> 2.) Before hitting any buttons, try selecting some text. For me,
> any text that I select is not highlighted (but it is
> selected). THIS IS THE BUG!
>
> 3.) Now, hit the 'enable' button (hitting disable at this point
> doesn't change anything for me). Now select some text. For
> me, selected text is now highlighted.
>
> 4.) Now, hit the 'disable' button, and select some text. For me,
> selected text is still highlighted.
>
> If others see this problem too, then I will submit the bug
> to activestate. If others don't see this bug, let me know too;
> maybe it's just me...
I see this problem;
it does not present in Tcl/Tk, and, therefore, changing first line 'use Tk;'
to
use Tcl::Tk qw/:perlTk/;
makes the problem go away
Vadim.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Craig M. Votava 2005-10-03, 6:58 pm |
| Folks-
It seems like there are lots of folks verifying
this bug. Many are suggesting it's a ptk bug and
not an activestate bug. Any suggestions on the
best way to report it as a ptk bug? Also, any
suggestions for a temporary workaround?
Thanks
-Craig
"Craig M. Votava" wrote:
>
> Folks-
>
> I think I may have found a bug in the ActiveState W32 Perl
> (version 5.8.7 build 813 and before). Please help me verify
> it if you can.
>
> This seems to work fine on unix boxes (SGIs & Suns), but
> doesn't work on Windows XP & 2000 (and maybe others).
>
> To verify:
>
> 1.) Run the following program:
> use Tk;
>
> my $mw = MainWindow->new;
> my $text = $mw->Scrolled('Text', -state=>'disabled')->pack;
>
> $text->configure(-state=>'normal');
> $text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
eight\nnine\nten\n");
> $text->configure(-state=>'disabled');
>
> $mw->Button(
> -text => "enable",
> -command => sub{$text->configure(-state=>'normal')} )->pack;
>
> $mw->Button(
> -text => "disable",
> -command => sub{$text->configure(-state=>'disabled')} )->pack;
>
> MainLoop;
>
> 2.) Before hitting any buttons, try selecting some text. For me,
> any text that I select is not highlighted (but it is
> selected). THIS IS THE BUG!
>
> 3.) Now, hit the 'enable' button (hitting disable at this point
> doesn't change anything for me). Now select some text. For
> me, selected text is now highlighted.
>
> 4.) Now, hit the 'disable' button, and select some text. For me,
> selected text is still highlighted.
>
> If others see this problem too, then I will submit the bug
> to activestate. If others don't see this bug, let me know too;
> maybe it's just me...
>
> If anybody has a fix, please let me know!
>
> Thanks
>
> -Craig Votava
>
> Lucent Technologies
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| listmail 2005-10-03, 6:58 pm |
| I didn't test this code since i'm not at work, but have you tested some
$mw->update and/or $text->update calls close to the disable/enable calls
? I've resolved a few unexpected results that way. The reason I used
the word "close" is that sometimes I've had to call update before
something like $widget->see('end') instead of what I believed would be
logically after....
Craig M. Votava wrote:
>Folks-
>
>It seems like there are lots of folks verifying
>this bug. Many are suggesting it's a ptk bug and
>not an activestate bug. Any suggestions on the
>best way to report it as a ptk bug? Also, any
>suggestions for a temporary workaround?
>
>Thanks
>
>-Craig
>
>"Craig M. Votava" wrote:
>
>
>-++**==--++**==--++**==--++**==--++**==--++**==--++**==
>This message was posted through the Stanford campus mailing list
>server. If you wish to unsubscribe from this mailing list, send the
>message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
>
>---------------------------------------------------------------------------------------------------
>Text inserted by Panda Platinum 2006 Internet Security:
>
> This message has NOT been classified as spam. If it is unsolicited mail (spam), click on the following link to reclassify it: http://127.0.0.1:6083/Panda?ID=pav_406&SPAM=true
>---------------------------------------------------------------------------------------------------
>
>
>
>
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Craig M. Votava 2005-10-04, 6:58 pm |
| I've tried inserting updates at various places, and nothing
seems to matter. It seems that the following is true:
-If the state of the text widget is 'disabled' before
going into mainloop, you'll experience the bug.
-If you change the state to 'normal' after going into
mainloop, everything works as expected.
-If you change the state back to 'disabled' after
going into mainloop, everything works as expected.
Any more pointers/suggestions are appreciated.
Thanks
-Craig
listmail wrote:[color=darkred]
>
> I didn't test this code since i'm not at work, but have you tested some
> $mw->update and/or $text->update calls close to the disable/enable calls
> ? I've resolved a few unexpected results that way. The reason I used
> the word "close" is that sometimes I've had to call update before
> something like $widget->see('end') instead of what I believed would be
> logically after....
>
> Craig M. Votava wrote:
>
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Vadim Konovalov 2005-10-04, 6:58 pm |
| > I've tried inserting updates at various places, and nothing
> seems to matter. It seems that the following is true:
>
> -If the state of the text widget is 'disabled' before
> going into mainloop, you'll experience the bug.
>
> -If you change the state to 'normal' after going into
> mainloop, everything works as expected.
>
> -If you change the state back to 'disabled' after
> going into mainloop, everything works as expected.
>
> Any more pointers/suggestions are appreciated.
My feeling (I didn't inspected internals for this) is that selection is
wrongfully unseen at first because that was overlooked by author of
perl/Tk module, but then widget restores to its normal behavior.
I think you should "simulate" switching forth and back to
enabled/disabled before actual work.
Such tricks, when do not work with suggested "update", they usually work
with "afterIdle" call.
HTH.
Vadim.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Craig M. Votava 2005-10-04, 6:58 pm |
| Vadim Konovalov wrote:
>
> My feeling (I didn't inspected internals for this) is that selection is
> wrongfully unseen at first because that was overlooked by author of
> perl/Tk module, but then widget restores to its normal behavior.
>
> I think you should "simulate" switching forth and back to
> enabled/disabled before actual work.
>
> Such tricks, when do not work with suggested "update", they usually work
> with "afterIdle" call.
>
> HTH.
> Vadim.
Hmmm, using afterIdle didn't work either...
Further investigation indicates that you need to
have the flashing text cursor bar, flashing in the
text window for selections to work at all (doesn't
matter if state=>'normal' or state=>'disabled').
Seems like the 'insert' mark has something to do
with this.
You can test this latest theory with the following code:
use Tk;
my $mw = MainWindow->new;
my $text = $mw->Text(-state=>'normal')->pack;
$text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
eight\nnine\nten\n");
$text->mark('set','insert', '1.1');
$mw->Button(
-text => "selectall",
-command => sub{$text->selectAll} )->pack;
MainLoop;
1.) When text window comes up, click on the selectall
button. On my PC, nothing is shown as selected.
2.) Now click somewhere in the text, so you have
the flashing text cursor bar.
3.) Now click on the selectall button. On my PC
everything is marked as selected.
Any other suggestions?
Thanks
-Craig
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| listmail 2005-10-04, 6:58 pm |
| First thing that comes to mind is $widget->focus;
Craig M. Votava wrote:
>Vadim Konovalov wrote:
>
>
>
>Hmmm, using afterIdle didn't work either...
>
>Further investigation indicates that you need to
>have the flashing text cursor bar, flashing in the
>text window for selections to work at all (doesn't
>matter if state=>'normal' or state=>'disabled').
>Seems like the 'insert' mark has something to do
>with this.
>
>You can test this latest theory with the following code:
>
>use Tk;
>
>my $mw = MainWindow->new;
>my $text = $mw->Text(-state=>'normal')->pack;
>
>$text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
eight\nnine\nten\n");
>$text->mark('set','insert', '1.1');
>
>$mw->Button(
> -text => "selectall",
> -command => sub{$text->selectAll} )->pack;
>
>MainLoop;
>
>1.) When text window comes up, click on the selectall
>button. On my PC, nothing is shown as selected.
>
>2.) Now click somewhere in the text, so you have
>the flashing text cursor bar.
>
>3.) Now click on the selectall button. On my PC
>everything is marked as selected.
>
>Any other suggestions?
>
>Thanks
>
>-Craig
>-++**==--++**==--++**==--++**==--++**==--++**==--++**==
>This message was posted through the Stanford campus mailing list
>server. If you wish to unsubscribe from this mailing list, send the
>message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
>
>---------------------------------------------------------------------------------------------------
>Text inserted by Panda Platinum 2006 Internet Security:
>
> This message has NOT been classified as spam. If it is unsolicited mail (spam), click on the following link to reclassify it: http://127.0.0.1:6083/Panda?ID=pav_426&SPAM=true
>---------------------------------------------------------------------------------------------------
>
>
>
>
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
| |
| Craig M. Votava 2005-10-06, 6:58 pm |
| listmail wrote:
>
> First thing that comes to mind is $widget->focus;
BINGO!
The following code displays the bug very well:
use Tk;
my $mw = MainWindow->new;
my $text = $mw->Text(-state=>'normal')->pack;
$text->insert('end'," one\ntwo\nthree\nfor\nfive\nsix\nseven\n
eight\nnine\nten\n");
$text->mark('set','insert', '1.1');
$mw->Button(
-text => "selectall",
-command => sub{$text->selectAll} )->pack;
$mw->Button(
-text => "focus",
-command => sub{$text->focus} )->pack;
MainLoop;
1.) Hit the selectall button. On my PC nothing gets
highlighted, indicating it's selected, even though
it really is.
2.) Now hit the focus button. As soon as I do, all
the selected text is highlighted.
There must be a bug that prevents the selected text
from being highlighted unless focus is there.
What's the best way to get this bug reported?
Thanks
-Craig
|
|
|
|
|