Use insertWithTags on diagnostic errors.
[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.3  1995-06-16 12:29:00  adam
8 # Use insertWithTags on diagnostic errors.
9 #
10 # Revision 1.2  1995/06/13  14:39:06  adam
11 # Fix: if {$var != ""} doesn't work if var is a large numerical!
12 # Highlight when line format is used.
13 #
14 # Revision 1.1  1995/06/12  15:18:10  adam
15 # Work on presentation formats. These are used in the main window as well
16 # as popup windows.
17 #
18 #
19
20 proc display-line {sno no w hflag} {
21     set type [z39.$sno type $no] 
22     if {$hflag} {
23         $w tag bind r$no <Any-Enter> \
24                 [list $w tag configure r$no -background gray80]
25         $w tag bind r$no <Any-Leave> \
26                 [list $w tag configure r$no -background {}]
27     } else {
28         $w delete 0.0 end
29     }
30     if {$type == "DB"} {
31         if {$hflag} {
32             set nostr [format "%5d " $no]
33             insertWithTags $w $nostr marc-tag
34         }
35         set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
36         set year  [lindex [z39.$sno getMarc $no field 260 * c] 0]
37         insertWithTags $w "$title - $year\n" marc-data
38         $w tag bind marc-data 
39     } elseif {$type == "SD"} {
40         set err [lindex [z39.$sno diag $no] 1]
41         set add [lindex [z39.$sno diag $no] 2]
42         if {$add != {}} {
43             set add " :${add}"
44         }
45         insertWithTags $w "Error ${err}${add}\n" marc-data
46     } elseif {$type == ""} {
47         return
48     }
49 }