Tk Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


chatwidget - Provides a multi-paned view suitable for display of chat room or irc channel information

Table Of Contents


package require Tk 8.5
package require chatwidget ?1.1.4?

::chatwidget::chatwidget path ?options?
$widget topic command args
$widget name nick args
$widget message text args
$widget hook command args
$widget names args
$widget entry args
$widget chat args


This is a composite widget designed to simplify the construction of chat applications. The widget contains display areas for chat messages, user names and topic and an entry area. It automatically handles colourization of messages per nick and manages nick completion. A system of hooks permit the application author to adjust display features. The main chat display area may be split for use displaying history or for searching.

The widget is made up of a number of text widget and panedwindow widgets so that the size of each part of the display may be adjusted by the user. All the text widgets may be accessed via widget passthrough commands if fine adjustment is required. The topic and names sections can also be hidden if desired.




chatwidget::chatwidget .chat
proc speak {w msg} {$w message $msg -nick user}
.chat hook add post [list speak .chat]
pack .chat -side top -fill both -expand 1
.chat topic show
.chat topic set "Chat widget demo"
.chat name add "admin" -group admin
.chat name add "user" -group users -color tomato
.chat message "Chatwidget ready" -type system
.chat message "Hello, user" -nick admin
.chat message "Hello, admin" -nick user

A more extensive example is available by examining the code for the picoirc program in the tclapps repository which ties the tcllib picoirc package to this chatwidget package to create a simple irc client.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category chatwidget of the Tklib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.




chat, chatwidget, composite widget, irc, mega-widget, widget