-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCaptureReleaseTest
84 lines (70 loc) · 2.27 KB
/
CaptureReleaseTest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use Tk;
use warnings;
use Tk::CaptureRelease;
use Data::Dumper (Dumper);
my $mw = MainWindow->new;
my $f = $mw->Frame->pack(-fill => 'both',
-expand => 1,
-anchor => 'nw',
-side => 'top');
my $l = $mw->Label(-text => 'Main Widget has been "popped"');
my $sf = $f->Frame;
my $e = $sf->Entry->pack(-fill => 'x',
-expand => 1);
my $b = $mw->Button(-command => 'main::popup',
-text => 'Pop-Up')->pack;
my $popped = 0;
$sf->pack(-fill => 'both',
-expand => 1);
#$sf->can('_wmRelease') && print ("can _wmRelease\n");
#$sf->can('wmRelease') && print ("can wmRelease\n");
*Tk::Widget::wmRelease = \&Tk::_wmRelease;
#$sf->wmRelease;
#$mw->wm('tracing', 1);
sub popup {
print "sf is mapped ".$sf->ismapped."\n";
if ($popped) {
#$l->packForget;
#$sf->packForget;
print "Capturing\n";
$sf->wmCapture;
print "Captured\n";
$sf->pack(-in => $f,
-fill => 'both',
-expand => 1);
print "Packed\n";
print "sf is mapped ".$sf->ismapped()."\n";
print "sf geometry ".$sf->geometry()."\n";
print "sf id".$sf->id()."\n";
print "sf Exists ".$sf->Exists()."\n";
$mw->update;
$popped = 0;
} else {
print "Before Release toplevel = ".$sf->toplevel()."\n";
print "Before Release toplevel id = ".$sf->toplevel()->id."\n";
my $wrapper = $sf->toplevel()->wrapper;
if( ref($wrapper)){ # dump to string, if ref
$wrapper = Dumper($wrapper);
}
print "Before Release toplevel wrapper = ".$wrapper."\n";
$sf->packForget;
$sf->wmRelease;
$sf->raise;
$sf->MainWindow::deiconify; # ARGH!
print $sf."\n";
print "toplevel = ".$sf->toplevel()."\n";
print "toplevel id = ".$sf->toplevel()->id."\n";
print "sf is mapped ".$sf->ismapped()."\n";
print "sf geometry ".$sf->geometry()."\n";
print "sf id".$sf->id()."\n";
print "sf state ".$sf->MainWindow::state()."\n";
$wrapper = $sf->MainWindow::wrapper;
if( ref($wrapper)){ # dump to string, if ref
$wrapper = Dumper($wrapper);
}
print "sf wrapper = ".$wrapper."\n";
#$sf->pack;
$popped = 1;
}
}
MainLoop;