Thread Tk::Balloon mit Schatten (4 answers)
Opened by #Kein Kommentar at 2007-12-13 23:33

#Kein Kommentar
 2007-12-13 23:33
#103862 #103862
User since
2007-06-09
575 Artikel
HausmeisterIn
[default_avatar]
hallo,

ich hatte gerade mal ein bisschen mit Tk::Balloon herumgespielt und einen schatten für das balloon-fenster programmiert (nur dirty und quick), um Win-Look hinzukriegen.

für alle die das auch benutzen wollen (es wird das Modul CPAN:Tk::StayOnTop benötigt, ist über ppm erhältlich):

1: Füg nach dem Kopf des Moduls ein use Tk::StayOnTop; ein.


2: Füge diesen Code ganz am Ende der Subroutine '-> Popup' ein (ca. Zeile 560)
Code: (dl )
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
    $w-> stayOnTop ();

# the shadow:
unless ($w-> {'shadow'}){
# create the toplevel 'shadow':
$w->{'shadow'} = $w-> Toplevel (
-height => $w-> height,
-width => $w-> width,
);
$w->{'shadow'}-> overrideredirect (1);

$w->{'shadow'}-> configure (-background => '#666666');
$w->{'shadow'}-> Label (-takefocus => 1)-> place ();

my ($shadow_x, $shadow_y) = ($xx+2, $y+11);
$w->{'shadow'}-> geometry ("+$shadow_x+$shadow_y");
}
else{

my ($shadow_x, $shadow_y) = ($xx+2, $y+11);
$w->{'shadow'}-> geometry ("+$shadow_x+$shadow_y");

$w-> {'shadow'}-> configure (-height => $w-> height, -width => $w-> width,);

$w->{'shadow'}-> deiconify ();
}



3: Jetzt den Inhalt von der Subroutine '-> Deactivate' mit diesem Code tauschen:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    my ($w) = @_;
my $delay = delete $w->{'delay'};
$delay->cancel if defined $delay;
if ($w->{'popped'}) {
my $client = $w->{'client'};
my $command = $w->GetOption(-cancelcommand => $client);
if (defined $command) {
# Execute the user's command and return if it returns false:
return if not $command->Call($client);
}
$w->withdraw;
$w-> {'shadow'}-> withdraw;
$w->ClearStatus;
$w->{'popped'} = 0;
$w->{'menu_index'} = 'none';
$w->{'canvas_tag'} = '';
}
$w->{'client'} = undef;
$w->{'subclient'} = undef;
$w->{'location'} = undef;


4: Ausprobieren! :)


den code hab ich jetzt nur so aus spaß gemacht, also ich habe ihn nur ein paar mal getestet und so... kommentare sind natürlich erwünscht..
Gerade weil wir alle in einem Boot sitzen, sollten wir froh sein, dass nicht alle auf unserer Seite sind

View full thread Tk::Balloon mit Schatten