Skip to content

Commit

Permalink
* dummy widget for selection
Browse files Browse the repository at this point in the history
  • Loading branch information
eserte committed Oct 11, 2007
1 parent 2af901d commit a67eb81
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions XMLViewer.pm
@@ -1,7 +1,7 @@
# -*- perl -*-

#
# $Id: XMLViewer.pm,v 1.35 2006/09/01 20:13:12 eserte Exp $
# $Id: XMLViewer.pm,v 1.36 2007/10/11 20:28:08 eserte Exp $
# Author: Slaven Rezic
#
# Copyright © 2000, 2003, 2004 Slaven Rezic. All rights reserved.
Expand All @@ -25,7 +25,7 @@ use XML::Parser;

Construct Tk::Widget 'XMLViewer';

$VERSION = '0.18';
$VERSION = '0.18_90';

my($curr_w); # ugly, but probably faster than defining handlers for everything
my $curr_xpath;
Expand Down Expand Up @@ -453,8 +453,16 @@ sub XPathToSelection {
my($w) = @_;
my($X,$Y) = @{$w->{PostPosition}};
my $xpath = $w->GetXPathFromXY($X, $Y);
$w->SelectionOwn;
$w->SelectionHandle

# Define a dummy widget holding the selection, so we can still use
# the Text selection after using XPathToSelection
my $dummy = $w->Subwidget("DummyLabelForSelection");
if (!$dummy) {
$dummy = $w->Component("Label" => "DummyLabelForSelection");
}

$dummy->SelectionOwn;
$dummy->SelectionHandle
(sub {
my($offset, $maxbytes) = @_;
substr($xpath, $offset, $maxbytes);
Expand Down

0 comments on commit a67eb81

Please sign in to comment.