1HList(3)              User Contributed Perl Documentation             HList(3)
2
3
4

NAME

6       Tk::HList - Create and manipulate Tix Hierarchial List widgets
7

SYNOPSIS

9       $hlist = $parent->HList(?options?);
10

STANDARD OPTIONS

12       -background    -borderwidth   -cursor   -exportselection -fore‐
13       ground    -font     -height   -highlightcolor -highlightthick‐
14       ness -relief   -selectbackground -selectforeground   -xscrollcom‐
15       mand     -yscrollcommand -width
16
17       See Tk::options for details of the standard options.
18

WIDGET-SPECIFIC OPTIONS

20       Name:     browsecmd
21       Class:    BrowseCmd
22       Switch:   -browsecmd
23           Specifies a perl/Tk callback to be executed when the user browses
24           through the entries in the HList widget.
25
26       Name:     columns
27       Class:    Columns
28       Switch:   -columns
29           Specifies the number of columns in this HList widget. This option
30           can only be set during the creation of the HList widget and cannot
31           be changed subsequently.
32
33       Name:     command
34       Class:    Command
35       Switch:   -command
36           Specifies the perl/Tk callback to be executed when the user invokes
37           a list entry in the HList widget. Normally the user invokes a list
38           entry by double-clicking it or pressing the Return key.
39
40       Name:     drawBranch
41       Class:    DrawBranch
42       Switch:   -drawbranch
43           A Boolean value to specify whether branch line should be drawn to
44           connect list entries to their parents.
45
46       Name:     foreground
47       Class:    Foreground
48       Switch:   -foreground
49       Alias:    -fg
50           [OBSOLETE] Specifies the default foreground color for the list
51           entries.
52
53       Name:     gap
54       Class:    Gap
55       Switch:   -gap
56           [OBSOLETE] The default distance between the bitmap/image and the
57           text in list entries.
58
59       Name:     header
60       Class:    Header
61       Switch:   -header
62           A Boolean value specifying whether headers should be displayed for
63           this HList widget (see the header method below).
64
65       Name:     height
66       Class:    Height
67       Switch:   -height
68           Specifies the desired height for the window in number of charac‐
69           ters.
70
71       Name:     indent
72       Class:    Indent
73       Switch:   -indent
74           Specifies the amount of horizontal indentation between a list entry
75           and its children. Must be a valid screen distance value.
76
77       Name:     indicator
78       Class:    Indicator
79       Switch:   -indicator
80           Specifies whether the indicators should be displayed inside the
81           HList widget. See the indicator method below.
82
83       Name:     indicatorCmd
84       Class:    IndicatorCmd
85       Switch:   -indicatorcmd
86           Specifies a perl/Tk callback to be executed when the user manipu‐
87           lates the indicator of an HList entry. The -indicatorcmd is trig‐
88           gered when the user press or releases the mouse button over the
89           indicator in an HList entry. By default the perl/Tk callback speci‐
90           fied by -indicatorcmd is executed with two additional arguments,
91           the entryPath of the entry whose indicator has been triggered and
92           additional information about the event.  The additional information
93           is one of the following strings:  <Arm>, <Disarm>, and <Activate>.
94
95       Name:     itemType
96       Class:    ItemType
97       Switch:   -itemtype
98           Specifies the default type of display item for this HList widget.
99           When you call the itemCreate, add and addchild methods, display
100           items of this type will be created if the -itemtype option is not
101           specified .
102
103       Name:     padX
104       Class:    Pad
105       Switch:   -padx
106           [OBSOLETE] The default horizontal padding for list entries.
107
108       Name:     padY
109       Class:    Pad
110       Switch:   -padx
111           [OBSOLETE] The default vertical padding for list entries.
112
113       Name:     selectBackground
114       Class:    SelectBackground
115       Switch:   -selectbackground
116           Specifies the background color for the selected list entries.
117
118       Name:     selectBorderWidth
119       Class:    BorderWidth
120       Switch:   -selectborderwidth
121           Specifies a non-negative value indicating the width of the 3-D bor‐
122           der to draw around selected items.  The value may have any of the
123           forms acceptable to Tk_GetPixels.
124
125       Name:     selectForeground
126       Class:    SelectForeground
127       Switch:   -selectforeground
128           Specifies the foreground color for the selected list entries.
129
130       Name:     selectMode
131       Class:    SelectMode
132       Switch:   -selectmode
133           Specifies one of several styles for manipulating the selection.
134           The value of the option may be arbitrary, but the default bindings
135           expect it to be either single, browse, multiple, or extended; the
136           default value is single.
137
138       Name:     sizeCmd
139       Class:    SizeCmd
140       Switch:   -sizecmd
141           Specifies a perl/Tk callback to be called whenever the HList widget
142           changes its size.  This method can be useful to implement ``user
143           scroll bars when needed'' features.
144
145       Name:     separator
146       Class:    Separator
147       Switch:   -separator
148           Specifies the character to used as the separator character when
149           intepreting the path-names of list entries. By default the charac‐
150           ter "." is used.
151
152       Name:     width
153       Class:    Width
154       Switch:   -width
155           Specifies the desired width for the window in characters.
156

DESCRIPTION

158       The HList method creates a new window (given by the $widget argument)
159       and makes it into a HList widget.  Additional options, described above,
160       may be specified on the command line or in the option database to con‐
161       figure aspects of the HList widget such as its cursor and relief.
162
163       The HList widget can be used to display any data that have a hierarchi‐
164       cal structure, for example, file system directory trees. The list
165       entries are indented and connected by branch lines according to their
166       places in the hierachy.
167
168       Each list entry is identified by an entryPath. The entryPath is a
169       sequence of entry names separated by the separator charactor (specified
170       by the -separator option). An entry name can be any string that does
171       not contain the separator charactor, or it can be the a string that
172       contains only one separator charactor.
173
174       For example, when "." is used as the separator charactor,
175       "one.two.three" is the entryPath for a list entry whose parent is
176       "one.two", whose parent is "one", which is a toplevel entry (has no
177       parents).
178
179       Another examples: ".two.three" is the entryPath for a list entry whose
180       parent is ".two", whose parent is ".", which is a toplevel entry.
181

DISPLAY ITEMS

183       Each list entry in an HList widget is associated with a display item.
184       The display item determines what visual information should be displayed
185       for this list entry. Please see Tk::DItem for a list of all display
186       items.  When a list entry is created by the itemCreate, add or addchild
187       widget methods, the type of its display item is determined by the
188       -itemtype option passed to these methods. If the -itemtype is omitted,
189       then by default the type specified by this HList widget's -itemtype
190       option is used.
191

WIDGET METHODS

193       The HList method creates a widget object.  This object supports the
194       configure and cget methods described in Tk::options which can be used
195       to enquire and modify the options described above.  The widget also
196       inherits all the methods provided by the generic Tk::Widget class.
197
198       The following additional methods are available HList widgets:
199
200       $hlist->add($entryPath ?,option=>value, ...?)
201           Creates a new list entry with the pathname $entryPath. A list entry
202           must be created after its parent is created (unless this entry is a
203           top-level entry, which has no parent).  See also "BUGS" below.
204           This method returns the entryPath of the newly created list entry.
205           The following configuration options can be given to configure the
206           list entry:
207
208           -at => position
209                   Insert the new list at the position given by position.
210                   position must be a valid integer. The position 0 indicates
211                   the first position, 1 indicates the second position, and so
212                   on.
213
214           -after => afterWhich
215                   Insert the new list entry after the entry identified by
216                   afterWhich. afterWhich must be a valid list entry and it
217                   mush have the same parent as the new list entry
218
219           -before => beforeWhich
220                   Insert the new list entry before the entry identified by
221                   beforeWhich. beforeWhich must be a valid list entry and it
222                   mush have the same parent as the new list entry
223
224           -data => string
225                   Specifies a string to associate with this list entry. This
226                   string can be queried by the info method. The application
227                   programmer can use the -data option to associate the list
228                   entry with the data it represents.
229
230           -itemtype => type
231                   Specifies the type of display item to be display for the
232                   new list entry. type must be a valid display item type.
233                   Currently the available display item types are imagetext,
234                   text, and $widget. If this option is not specified, then by
235                   default the type specified by this HList widget's -itemtype
236                   option is used.
237
238           -state => state
239                   Specifies whether this entry can be selected or invoked by
240                   the user.  Must be either normal or disabled.
241
242           The add method accepts additional configuration options to config‐
243           ure the display item associated with this list entry. The set of
244           additional configuration options depends on the type of the display
245           item given by the -itemtype option. Please see Tk::DItem for a list
246           of the configuration options for each of the display item types.
247
248       $hlist->addchild($parentPath, ?option, value, ..., ?)
249           Adds a new child entry to the children list of the list entry iden‐
250           tified by $parentPath. Or, if $parentPath is set to be the empty
251           string, then creates a new toplevel entry. The name of the new list
252           entry will be a unique name automatically generated by the HList
253           widget. Usually if $parentPath is foo, then the entryPath of the
254           new entry will be foo.0, foo.1, ... etc.  This method returns the
255           entryPath of the newly created list entry.  option can be any
256           option for the add method.  See also "BUGS" below.
257
258       $hlist->anchorSet($entryPath)
259           Sets the anchor to the list entry identified by $entryPath.  The
260           anchor is the end of the selection that is fixed while the user is
261           dragging out a selection with the mouse.
262
263       $hlist->anchorClear
264           Removes the anchor, if any, from this HList widget. This only
265           removes the surrounding highlights of the anchor entry and does not
266           affect its selection status.
267
268       $hlist->columnWidth($col?, -char?, ?width?)
269           Querys or sets the width of a the column $col in the HList widget.
270           The value of $col is zero-based: 0 stands for the first column, 1
271           stands for the second, and so on. If no further parameters are
272           given, returns the current width of this column (in number of pix‐
273           els). Additional parameters can be given to set the width of this
274           column:
275
276           $hlist->columnWidth($col, '')
277                   An empty string indicates that the width of the column
278                   should be just wide enough to display the widest element in
279                   this column. In this case, the width of this column may
280                   change as a result of the elements in this column changing
281                   their sizes.
282
283           $hlist->columnWidth($col, width)
284                   width must be in a form accepted by Tk_GetPixels.
285
286           $hlist->columnWidth($col, -char, nChars)
287                   The width is set to be the average width occupied by nChars
288                   number of characters of the font specified by the -font
289                   option of this HList widget.
290
291       $hlist->delete(option, $entryPath)
292           Delete one or more list entries. option may be one of the follow‐
293           ing:
294
295           all     Delete all entries in the HList. In this case the $entry‐
296                   Path does not need to be specified.
297
298           entry   Delete the entry specified by $entryPath and all its off‐
299                   springs, if any.
300
301           offsprings
302                   Delete all the offsprings, if any, of the entry specified
303                   by $entryPath. However, $entryPath itself is not deleted.
304
305           siblings
306                   Delete all the list entries that share the same parent with
307                   the entry specified by $entryPath. However, $entryPath
308                   itself is not deleted.
309
310       $hlist->dragsiteSet($entryPath)
311           Sets the dragsite to the list entry identified by $entryPath. The
312           dragsite is used to indicate the source of a drag-and-drop action.
313           Currently drag-and-drop functionality has not been implemented in
314           Tix yet.
315
316       $hlist->dragsiteClear
317           Remove the dragsite, if any, from the this HList widget. This only
318           removes the surrounding highlights of the dragsite entry and does
319           not affect its selection status.
320
321       $hlist->dropsiteSet($entryPath)
322           Sets the dropsite to the list entry identified by $entryPath. The
323           dropsite is used to indicate the target of a drag-and-drop action.
324           Currently drag-and-drop functionality has not been implemented in
325           Tix yet.
326
327       $hlist->dropsiteClear
328           Remove the dropsite, if any, from the this HList widget. This only
329           removes the surrounding highlights of the dropsite entry and does
330           not affect its selection status.
331
332       $hlist->entrycget($entryPath, option)
333           Returns the current value of the configuration option given by
334           option for the entry indentfied by $entryPath. Option may have any
335           of the values accepted by the add method.
336
337       $hlist->entryconfigure($entryPath ?,option?, ?value=>option, ...?)
338           Query or modify the configuration options of the list entry indent‐
339           fied by $entryPath. If no option is specified, returns a list
340           describing all of the available options for $entryPath (see
341           Tk::options for information on the format of this list.) If option
342           is specified with no value, then the method returns a list describ‐
343           ing the one named option (this list will be identical to the corre‐
344           sponding sublist of the value returned if no option is specified).
345           If one or more option-value pairs are specified, then the method
346           modifies the given option(s) to have the given value(s); in this
347           case the method returns an empty string.  Option may have any of
348           the values accepted by the add or addchild method. The exact set of
349           options depends on the value of the -itemtype option passed to the
350           the add or addchild method when this list entry is created.
351
352       $hlist->header(option, $col ?,args, ...?)
353           Manipulates the header items of this HList widget. If the -header
354           option of this HList widget is set to true, then a header item is
355           displayed at the top of each column. The $col argument for this
356           method must be a valid integer. 0 indicates the first column, 1 the
357           second column, ... and so on. This method supports the following
358           options:
359
360           $hlist->header(cget, $col, option)
361                   If the $col-th column has a header display item, returns
362                   the value of the specified option of the header item. If
363                   the header doesn't exist, returns an error.
364
365           $hlist->header(configure, $col, ?option?, ?value, option, value,
366           ...?)
367                   Query or modify the configuration options of the header
368                   display item of the $col-th column. The header item must
369                   exist, or an error will result.  If no option is specified,
370                   returns a list describing all of the available options for
371                   the header display item (see Tk::options for information on
372                   the format of this list.) If option is specified with no
373                   value, then the method returns a list describing the one
374                   named option (this list will be identical to the corre‐
375                   sponding sublist of the value returned if no option is
376                   specified). If one or more option-value pairs are speci‐
377                   fied, then the method modifies the given option(s) to have
378                   the given value(s); in this case the method returns an
379                   empty string. Option may have any of the values accepted by
380                   the header create method. The exact set of options depends
381                   on the value of the -itemtype option passed to the the
382                   header create method when this display item was created.
383
384           $hlist->header(create, $col, ?-itemtype type? ?option value ...?
385                   Creates a new display item as the header for the $col-th
386                   column. See also "BUGS" below.  If an header display item
387                   already exists for this column, it will be replaced by the
388                   new item.  An optional parameter -itemtype can be used to
389                   specify what type of display item should be created. If the
390                   -itemtype is not given, then by default the type specified
391                   by this HList widget's -itemtype option is used. Additional
392                   parameters, in option-value pairs, can be passed to config‐
393                   ure the appearance of the display item. Each option-value
394                   pair must be a valid option for this type of display item
395                   or one of the following:
396
397                   -borderwidth => color
398                               Specifies the border width of this header item.
399
400                   -headerbackground => color
401                               Specifies the background color of this header
402                               item.
403
404                   -relief => type
405                               Specifies the relief type of the border of this
406                               header item.
407
408           $hlist->header(delete, $col)
409                   Deletes the header display item for the $col-th column.
410
411           $hlist->header(exists, $col)
412                   Return true if an header display item exists for the
413                   $col-th column; return false otherwise.
414
415           $hlist->header(size, $entryPath)
416                   If an header display item exists for the $col-th column ,
417                   returns its size in pixels in a two element list (width,
418                   height); returns an error if the header display item does
419                   not exist.
420
421       $hlist->hide(option ?,$entryPath?)
422           Makes some of entries invisible without deleting them.  Option can
423           be one of the following:
424
425           entry   Hides the list entry identified by $entryPath.
426
427           Currently only the entry option is supported. Other options will be
428           added in the next release.
429
430       $hlist->indicator(option, $entryPath, ?args, ...?)
431           Manipulates the indicator on the list entries. An indicator is usu‐
432           ally a small display item (such as an image) that is displayed to
433           the left to an entry to indicate the status of the entry.  For
434           example, it may be used to indicate whether a directory is opened
435           or closed.  Option can be one of the following:
436
437           $hlist->indicator(cget, $entryPath, option)
438                   If the list entry given by $entryPath has an indicator,
439                   returns the value of the specified option of the indicator.
440                   If the indicator doesn't exist, returns an error.
441
442           $hlist->indicator(configure, $entryPath, ?option?, ?value, option,
443           value, ...?)
444                   Query or modify the configuration options of the indicator
445                   display item of the entry specified by $entryPath. The
446                   indicator item must exist, or an error will result.  If no
447                   option is specified, returns a list describing all of the
448                   available options for the indicator display item (see
449                   Tk::options for information on the format of this list). If
450                   option is specified with no value, then the method returns
451                   a list describing the one named option (this list will be
452                   identical to the corresponding sublist of the value
453                   returned if no option is specified). If one or more option-
454                   value pairs are specified, then the method modifies the
455                   given option(s) to have the given value(s); in this case
456                   the method returns an empty string.  Option may have any of
457                   the values accepted by the indicator create method. The
458                   exact set of options depends on the value of the -itemtype
459                   option passed to the the indicator create method when this
460                   display item was created.
461
462           $hlist->indicator(create, $entryPath, ?, -itemtype type? ?option
463           value ...?)
464                   Creates a new display item as the indicator for the entry
465                   specified by $entryPath. If an indicator display item
466                   already exists for this entry, it will be replaced by the
467                   new item.  An optional parameter -itemtype can be used to
468                   specify what type of display item should be created. If the
469                   -itemtype is not given, then by default the type specified
470                   by this HList widget's -itemtype option is used. Additional
471                   parameters, in option-value pairs, can be passed to config‐
472                   ure the appearance of the display item. Each option-value
473                   pair must be a valid option for this type of display item.
474
475           $hlist->indicator(delete, $entryPath)
476                   Deletes the indicator display item for the entry given by
477                   $entryPath.
478
479           $hlist->indicator(exists, $entryPath)
480                   Return true if an indicator display item exists for the
481                   entry given by $entryPath; return false otherwise.
482
483           $hlist->indicator(size, $entryPath)
484                   If an indicator display item exists for the entry given by
485                   $entryPath, returns its size in a two element list of the
486                   form {width height}; returns an error if the indicator dis‐
487                   play item does not exist.
488
489       $hlist->info(option, arg, ...)
490           Query information about the HList widget. option can be one of the
491           following:
492
493           $hlist->info(anchor)
494                   Returns the entryPath of the current anchor, if any, of the
495                   HList widget. If the anchor is not set, returns the empty
496                   string.
497
498           $hlist->infoBbox($entryPath)
499                   Returns a list of four numbers describing the visible
500                   bounding box of the entry given $entryPath. The first two
501                   elements of the list give the x and y coordinates of the
502                   upper-left corner of the screen area covered by the entry
503                   (specified in pixels relative to the widget) and the last
504                   two elements give the lower-right corner of the area, in
505                   pixels. If no part of the entry given by index is visible
506                   on the screen then the result is an empty string; if the
507                   entry is partially visible, the result gives the only the
508                   visible area of the entry.
509
510           $hlist->info(children ?,$entryPath?)
511                   If $entryPath is given, returns a list of the entryPath's
512                   of its children entries. Otherwise returns a list of the
513                   toplevel entryPath's.
514
515           $hlist->info(data ?,$entryPath?)
516                   Returns the data associated with $entryPath.
517
518           $hlist->info(dragsite)
519                   Returns the entryPath of the current dragsite, if any, of
520                   the HList widget. If the dragsite is not set, returns the
521                   empty string.
522
523           $hlist->info(dropsite)
524                   Returns the entryPath of the current dropsite, if any, of
525                   the HList widget. If the dropsite is not set, returns the
526                   empty string.
527
528           $hlist->info(exists, $entryPath)
529                   Returns a boolean value indicating whether the list entry
530                   $entryPath exists.
531
532           $hlist->info(hidden, $entryPath)
533                   Returns a boolean value indicating whether the list entry
534                   $entryPath is hidden or not.
535
536           $hlist->info(next, $entryPath)
537                   Returns the entryPath of the list entry, if any, immedi‐
538                   ately below this list entry. If this entry is already at
539                   the bottom of the HList widget, returns an empty string.
540
541           $hlist->info(parent, $entryPath)
542                   Returns the name of the parent of the list entry identified
543                   by $entryPath. If entryPath is a toplevel list entry,
544                   returns the empty string.
545
546           $hlist->info(prev, $entryPath)
547                   Returns the entryPath of the list entry, if any, immedi‐
548                   ately above this list entry. If this entry is already at
549                   the top of the HList widget, returns an empty string.
550
551           $hlist->info(selection)
552                   Returns a list of selected entries in the HList widget. In
553                   scalar context, returns an anonymous list of the selected
554                   entries.  If no entries are selected, undef is returned in
555                   scalar context, and an empty list otherwise.
556
557       $hlist->item(option, ?args, ...?)
558           Creates and configures the display items at individual columns the
559           entries. The form of additional of arguments depends on the choice
560           of option:
561
562           $hlist->itemCget($entryPath, $col, option)
563                   Returns the current value of the configure option of the
564                   display item at the column designated by $col of the entry
565                   specified by $entryPath.
566
567           $hlist->itemConfigure($entryPath, $col ?,option?, ?value, option,
568           value, ...?)
569                   Query or modify the configuration options of the display
570                   item at the column designated by $col of the entry speci‐
571                   fied by $entryPath. If no option is specified, returns a
572                   list describing all of the available options for $entryPath
573                   (see Tk::options for information on the format of this
574                   list). If option is specified with no value, then the
575                   method returns a list describing the one named option (this
576                   list will be identical to the corresponding sublist of the
577                   value returned if no option is specified). If one or more
578                   option-value pairs are specified, then the method modifies
579                   the given option(s) to have the given value(s); in this
580                   case the method returns an empty string.  Option may have
581                   any of the values accepted by the item create method. The
582                   exact set of options depends on the value of the -itemtype
583                   option passed to the the item create method when this dis‐
584                   play item was created.
585
586           $hlist->itemCreate($entryPath, $col ?,-itemtype=>type? ?,option
587           value ...?)
588                   Creates a new display item at the column designated by $col
589                   of the entry specified by $entryPath. An optional parameter
590                   -itemtype can be used to specify what type of display items
591                   should be created. If the -itemtype is not specified, then
592                   by default the type specified by this HList widget's -item‐
593                   type option is used.  Additional parameters, in option-
594                   value pairs, can be passed to configure the appearance of
595                   the display item. Each option- value pair must be a valid
596                   option for this type of display item.
597
598           $hlist->itemDelete($entryPath, $col)
599                   Deletes the display item at the column designated by $col
600                   of the entry specified by $entryPath.
601
602           $hlist->itemExists($entryPath, $col)
603                   Returns true if there is a display item at the column des‐
604                   ignated by $col of the entry specified by $entryPath;
605                   returns false otherwise.
606
607       $hlist->nearest(y)
608           $hlist->nearest(y) Given a y-coordinate within the HList window,
609           this method returns the entryPath of the (visible) HList element
610           nearest to that y-coordinate.
611
612       $hlist->see($entryPath)
613           Adjust the view in the HList so that the entry given by $entryPath
614           is visible. If the entry is already visible then the method has no
615           effect; if the entry is near one edge of the window then the HList
616           scrolls to bring the element into view at the edge; otherwise the
617           HList widget scrolls to center the entry.
618
619       $hlist->selection(option, arg, ...)
620       $hlist->selectionOption(arg, ...)
621           This method is used to adjust the selection within a HList widget.
622           It has several forms, depending on option:
623
624           $hlist->selectionClear(?from?, ?to?)
625                   When no extra arguments are given, deselects all of the
626                   list entrie(s) in this HList widget. When only from is
627                   given, only the list entry identified by from is dese‐
628                   lected. When both from and to are given, deselects all of
629                   the list entrie(s) between between from and to, inclusive,
630                   without affecting the selection state of elements outside
631                   that range.
632
633           $hlist->selectionGet
634                   This is an alias for the infoSelection method.
635
636           $hlist->selectionIncludes($entryPath)
637                   Returns 1 if the list entry indicated by $entryPath is cur‐
638                   rently selected; returns 0 otherwise.
639
640           $hlist->selectionSet(from?, to?)
641                   Selects all of the list entrie(s) between between from and
642                   to, inclusive, without affecting the selection state of
643                   entries outside that range. When only from is given, only
644                   the list entry identified by from is selected.
645
646       $hlist->show(option ?,$entryPath?)
647           Show the entries that are hidden by the hide method, option can be
648           one of the following:
649
650           entry   Shows the list entry identified by $entryPath.
651
652           Currently only the entry option is supported. Other options will be
653           added in future releases.
654
655       $hlist->xview(args)
656           This method is used to query and change the horizontal position of
657           the information in the widget's window. It can take any of the fol‐
658           lowing forms:
659
660           $hlist->xview
661                   Returns a list containing two elements.  Each element is a
662                   real fraction between 0 and 1; together they describe the
663                   horizontal span that is visible in the window.  For exam‐
664                   ple, if the first element is .2 and the second element is
665                   .6, 20% of the HList entry is off-screen to the left, the
666                   middle 40% is visible in the window, and 40% of the entry
667                   is off-screen to the right. These are the same values
668                   passed to scrollbars via the -xscrollcommand option.
669
670           $hlist->xview($entryPath)
671                   Adjusts the view in the window so that the list entry iden‐
672                   tified by $entryPath is aligned to the left edge of the
673                   window.
674
675           $hlist->xview(moveto => fraction)
676                   Adjusts the view in the window so that fraction of the
677                   total width of the HList is off-screen to the left. frac‐
678                   tion must be a fraction between 0 and 1.
679
680           $hlist->xview(scroll => number, what)
681                   This method shifts the view in the window left or right
682                   according to number and what. Number must be an integer.
683                   What must be either units or pages or an abbreviation of
684                   one of these. If what is units, the view adjusts left or
685                   right by number character units (the width of the 0 charac‐
686                   ter) on the display; if it is pages then the view adjusts
687                   by number screenfuls. If number is negative then characters
688                   farther to the left become visible; if it is positive then
689                   characters farther to the right become visible.
690
691       $hlist->yview(?args?)
692           This method is used to query and change the vertical position of
693           the entries in the widget's window. It can take any of the follow‐
694           ing forms:
695
696           $hlist->yview
697                   Returns a list containing two elements, both of which are
698                   real fractions between 0 and 1.  The first element gives
699                   the position of the list element at the top of the window,
700                   relative to the HList as a whole (0.5 means it is halfway
701                   through the HList, for example).  The second element gives
702                   the position of the list entry just after the last one in
703                   the window, relative to the HList as a whole.  These are
704                   the same values passed to scrollbars via the -yscrollcom‐
705                   mand option.
706
707           $hlist->yview($entryPath)
708                   Adjusts the view in the window so that the list entry given
709                   by $entryPath is displayed at the top of the window.
710
711           $hlist->yview(moveto => fraction)
712                   Adjusts the view in the window so that the list entry given
713                   by fraction appears at the top of the window. Fraction is a
714                   fraction between 0 and 1; 0 indicates the first entry in
715                   the HList, 0.33 indicates the entry one-third the way
716                   through the HList, and so on.
717
718           $hlist->yview(scroll => number, what)
719                   This method adjust the view in the window up or down
720                   according to number and what.  Number must be an integer.
721                   What must be either units or pages.  If what is units, the
722                   view adjusts up or down by number lines; if it is pages
723                   then the view adjusts by number screenfuls.  If number is
724                   negative then earlier entries become visible; if it is pos‐
725                   itive then later entries become visible.
726

BINDINGS

728       [1] If the -selectmode is "browse", when the user drags the mouse
729           pointer over the list entries, the entry under the pointer will be
730           highlighted and the -browsecmd callback will be called with one
731           parameter, the entryPath of the highlighted entry. Only one entry
732           can be highlighted at a time. The -command callback will be called
733           when the user double-clicks on a list entry.
734
735       [2] If the -selectmode is "single", the entries will only be high‐
736           lighted by mouse <ButtonRelease-1> events. When a new list entry is
737           highlighted, the -browsecmd callback will be called with one param‐
738           eter indicating the highlighted list entry. The -command callback
739           will be called when the user double-clicks on a list entry.
740
741       [3] If the -selectmode is "multiple", when the user drags the mouse
742           pointer over the list entries, all the entries under the pointer
743           will be highlighted. However, only a contiguous region of list
744           entries can be selected. When the highlighted area is changed, the
745           -browsecmd callback will be called with an undefined parameter. It
746           is the responsibility of the -browsecmd callback to find out the
747           exact highlighted selection in the HList. The -command callback
748           will be called when the user double-clicks on a list entry.
749
750       [4] If the -selectmode is "extended", when the user drags the mouse
751           pointer over the list entries, all the entries under the pointer
752           will be highlighted. The user can also make disjointed selections
753           using <Control-ButtonPress-1>. When the highlighted area is
754           changed, the -browsecmd callback will be called with an undefined
755           parameter. It is the responsibility of the -browsecmd callback to
756           find out the exact highlighted selection in the HList. The -command
757           callback will be called when the user double-clicks on a list
758           entry.
759
760       [5] Arrow key bindings: <Up> arrow key moves the anchor point to the
761           item right on top of the current anchor item. <Down> arrow key
762           moves the anchor point to the item right below the current anchor
763           item.  <Left> arrow key moves the anchor to the parent item of the
764           current anchor item. <Right> moves the anchor to the first child of
765           the current anchor item. If the current anchor item does not have
766           any children, moves the anchor to the item right below the current
767           anchor item.
768

EXAMPLE

770       This example demonstrates how to use an HList to store a file directory
771       structure and respond to the user's browse events:
772
773          use strict;
774          use Tk;
775          use Tk::Label;
776          use Tk::HList;
777
778          my $mw = MainWindow->new();
779          my $label = $mw->Label(-width=>15);
780          my $hlist = $mw->HList(
781                              -itemtype   => 'text',
782                              -separator  => '/',
783                              -selectmode => 'single',
784                              -browsecmd  => sub {
785                                        my $file = shift;
786                                        $label->configure(-text=>$file);
787                                     }
788                              );
789
790          foreach ( qw(/ /home /home/ioi /home/foo /usr /usr/lib) ) {
791              $hlist->add($_, -text=>$_);
792          }
793
794          $hlist->pack;
795          $label->pack;
796
797          MainLoop;
798

BUGS

800       The fact that the display item at column 0 is implicitly associated
801       with the whole entry is probably a design bug. This was done for back‐
802       ward compatibility purposes. The result is that there is a large over‐
803       lap between the item method and the add, addchild, entrycget and
804       entryconfigure methods.  Whenever multiple columns exist, the program‐
805       mer should use ONLY the item method to create and configure the display
806       items in each column; the add, addchild, entrycget and entryconfigure
807       should be used ONLY to create and configure entries.
808

KEYWORDS

810       Hierarchical Listbox
811

SEE ALSO

813       Tk::DItem
814
815
816
817perl v5.8.8                       2008-02-05                          HList(3)
Impressum