Schrift
[thread]4728[/thread]

Hyperlink in Widget

Leser: 1


<< >> 7 Einträge, 1 Seite
format_c
 2004-03-07 22:52
#41718 #41718
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Hi,
Ich habe mal wieder eine Frag zu Grafischen Oberflächen.
wie kann ich einen Hyperlink in eine z.B. Label einfügen?

Des weiteren, öffne ich ein Toplevel Fenster. Allerdings ist auf das Fenster kein Focus.

kann mir da jemand helfen.

Gruß Alex
Strat
 2004-03-08 00:52
#41719 #41719
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
Wovon sprichst du? was verstehst du mit Hyperlink?
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/
esskar
 2004-03-08 01:29
#41720 #41720
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
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
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
# bind.pl

use vars qw/$TOP/;

sub bind {

# Create a top-level window that illustrates how you can bind Perl
# commands to regions of text in a text widget.

my($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text =>'',
-title => 'Text Demonstration - Tag Bindings',
-iconname => 'bind',
);

my $t = $TOP->Scrolled(qw/Text -setgrid true -width 60 -height 24
-scrollbars e -wrap word/, -font => $FONT);
$t->pack(qw/-expand yes -fill both/);

# Set up display styles

my(@bold, @normal, $tag);
if ($TOP->depth > 1) {
@bold = (-background => '#43ce80', qw/-relief raised -borderwidth 1/);
@normal = (-background => undef, qw/-relief flat/);
} else {
@bold = (qw/-foreground white -background black/);
@normal = (-foreground => undef, -background => undef);
}

$t->insert('0.0', "The same tag mechanism that controls display styles in text widgets can also be used to associate Perl commands with regions of text, so that mouse or keyboard actions on the text cause particular Perl commands to be invoked. For example, in the text below the descriptions of the canvas demonstrations have been tagged. When you move the mouse over a demo description the description lights up, and when you press button 1 over a description then that particular demonstration is invoked.\n\n");
$t->insert('end','1. Samples of all the different types of items that can be created in canvas widgets.', 'd1');
$t->insert('end', "\n\n");
$t->insert('end', '2. A simple two-dimensional plot that allows you to adjust the positions of the data points.', 'd2');
$t->insert('end', "\n\n");
$t->insert('end', '3. Anchoring and justification modes for text items.', 'd3');
$t->insert('end', "\n\n");
$t->insert('end', '4. An editor for arrow-head shapes for line items.', 'd4');
$t->insert('end', "\n\n");
$t->insert('end', '5. A ruler with facilities for editing tab stops.', 'd5');
$t->insert('end', "\n\n");
$t->insert('end', '6. A grid that demonstrates how canvases can be scrolled.', 'd6');

foreach $tag (qw(d1 d2 d3 d4 d5 d6)) {
$t->tag('bind', $tag, '<Any-Enter>' =>
sub {shift->tag('configure', $tag, @bold)}
);
$t->tag('bind', $tag, '<Any-Leave>' =>
sub {shift->tag('configure', $tag, @normal)}
);
}
$t->tag(qw/bind d1 <1>/ => sub {&items('items')});
$t->tag(qw/bind d2 <1>/ => sub {&plot('plot')});
$t->tag(qw/bind d3 <1>/ => sub {&ctext('ctext')});
$t->tag(qw/bind d4 <1>/ => sub {&arrows('arrows')});
$t->tag(qw/bind d5 <1>/ => sub {&ruler('ruler')});
$t->tag(qw/bind d6 <1>/ => sub {&cscroll('cscroll')});

$t->mark(qw/set insert 0.0/);

} # end bind

1;
format_c
 2004-03-08 09:43
#41721 #41721
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
@esskar: Ich verstehe deinen Code nicht. Was soll er machen?

@Strat: So soll es aussehen:
http://www.creedforever.com/test/hyperlink.jpg

Gruß Alex
esskar
 2004-03-08 11:29
#41722 #41722
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
schau dir mal das widget beispiel an, dass bei tk mitkommt perl/bin/widget
dort findest du dieses beispiel (ausführbar)
ptk
 2004-03-08 11:44
#41723 #41723
User since
2003-11-28
3645 Artikel
ModeratorIn
[default_avatar]
Mit Tk::Label geht das nicht, nur mit Tk::Text. esskar hat dich ja auf das widget-Programm verwiesen.
format_c
 2004-03-08 13:47
#41724 #41724
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Ah danke ich werd es mir mal zu Hause genauer ansehen.

Gruß Alex
<< >> 7 Einträge, 1 Seite



View all threads created 2004-03-07 22:52.