Hrm. I did the test you mention, and it still worked under Linux. I added and focused on a new ROText at every opportunity, and it still insisted on working. Here's the code I used:
#!/usr/local/bin/perl
use Tk; use Tk::ROText;
my $mw = MainWindow->new();
$a=$mw->ROText(height=>2)->pack; $a->insert('end','foo'); $a->focus;
$rot = $mw->ROText(height=>2)->pack;
$a=$mw->ROText(height=>2)->pack; $a->insert('end','foo'); $a->focus;
$rot->insert('end', 'foo ');
$a=$mw->ROText(height=>2)->pack; $a->insert('end','foo'); $a->focus;
$rot->insert('end', 'the bar', ['mytag','sel']);
$a=$mw->ROText(height=>2)->pack; $a->insert('end','foo'); $a->focus;
$rot->insert('end', ' is baz');
$a=$mw->ROText(height=>2)->pack; $a->insert('end','foo'); $a->focus;
MainLoop;
So it looks like Linux doesn't care about where the focus is, when it's selecting text. Having to push the focus around to do selections strikes me as more than a little odd. Apparently Linux has the same opinion.. Anyways, glad you were able to puzzle this one out -- it looks like it's one of the long list of "problems that aren't documented anywhere, but should be!"
Addendum: It looks like this is tied to Windows' treatment of selections. For instance, the following code leaves all three boxes with selections under Linux, but only the last one selected under Windows:
#!/usr/local/bin/perl
use Tk; use Tk::ROText;
my $mw = MainWindow->new();
for (1..3) {
$a = $mw->ROText(height=>2)->pack;
$a->focus;
$a->insert('end','foo',['sel']);
$a->focus;
}
MainLoop;
..which means that the Windows port will always be slightly broken -- the ->focus() stuff is just an indication of this. Anyways, hope this helps. | [reply] [d/l] [select] |
Many thanks for your time and effort! Yet another Windows
anomaly, it seems. I yearn for the day when Mr. Bill doesn't
live in my computer anymore. It's not here yet, but it's
drawing nigh.
| [reply] |