Fix: if {$var != ""} doesn't work if var is a large numerical!
[ir-tcl-moved-to-github.git] / formats / line.tcl
1 # IR toolkit for tcl/tk
2 # (c) Index Data 1995
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
5 #
6 # $Log: line.tcl,v $
7 # Revision 1.2  1995-06-13 14:39:06  adam
8 # Fix: if {$var != ""} doesn't work if var is a large numerical!
9 # Highlight when line format is used.
10 #
11 # Revision 1.1  1995/06/12  15:18:10  adam
12 # Work on presentation formats. These are used in the main window as well
13 # as popup windows.
14 #
15 #
16
17 proc display-line {sno no w hflag} {
18     set type [z39.$sno type $no] 
19     if {$hflag} {
20         $w tag bind r$no <Any-Enter> \
21                 [list $w tag configure r$no -background gray80]
22         $w tag bind r$no <Any-Leave> \
23                 [list $w tag configure r$no -background {}]
24     } else {
25         $w delete 0.0 end
26     }
27     if {$type == "DB"} {
28         if {$hflag} {
29             set nostr [format "%5d " $no]
30             insertWithTags $w $nostr marc-tag
31         }
32         set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
33         set year  [lindex [z39.$sno getMarc $no field 260 * c] 0]
34         insertWithTags $w "$title - $year\n" marc-data
35         $w tag bind marc-data 
36     } elseif {$type == "SD"} {
37         set err [lindex [z39.$sno diag $no] 1]
38         set add [lindex [z39.$sno diag $no] 2]
39         if {$add != {}} {
40             set add " :${add}"
41         }
42         $w insert end "Error ${err}${add}\n"
43     } elseif {$type == ""} {
44         return
45     }
46 }