Tk::Playlist - Tk::HList subclass providing playlist-like manipulation


  use Tk::Playlist;

  my $playlist = $widget->Playlist(-readonly => 0);
  $playlist->add("foobar.mp3", -text => "The FooBar Song");
  $playlist->callback_change([ \&rewrite_m3u, "filename.m3u" ]);


The Tk::Playlist widget is derived from the standard Tk::HList widget. See it's documentation for more information.

In addition to the standard HList functionality, the Tk::Playlist widget adds the ability to modify the list directly. Isers may drag entries up and down the list and delete items from the list using the "Delete" key.


Switch: -readonly
Method: readonly

Specifies that the list may not be modified.

Switch: -callback_change
Method: callback_change

Specifies a Tk callback to be executed whenever the list is changed by the user. The callback is called once for each item that has changed. the first parameter is either "move" (to indicate an item has been moved), "done_moving" (to indicate the user has released the mouse button and is done dragging entries around), or "delete" (to indicate an item has been deleted).

When the first parameter is "move" or "delete", the second parameter is the tag that was assigned to the item (see Tk::HList->add for more info).

When the first parameter is "move", the third parameter is the new position of the item on the list, with the top of the list being "1".


When a user attempts to drag an entry beyond the top of the list, the position (third) parameter passed to callback_change is "0". This could be considered a bug or a feature.


Tk::HList, Tk::callbacks


Tyler MacDonald, <>


Copyright (C) 2004 by Tyler MacDonald

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.