chatwidget(n)
π¬ chatwidget(n) β composite widget for chat applications β¨
πΈ NAME πΈ
chatwidget β Provides a multi-paned view suitable for display of chat room or irc channel information. π
β¨ SYNOPSIS β¨
package require Tk 8.5
package require chatwidget ?1.0.0?
::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
π¦ DESCRIPTION π¦
Okay so bestie, this is a composite widget designed to simplify the construction of chat applications. It literally 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 permits 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. π«Ά
π COMMANDS π
::chatwidget::chatwidget path ?options?β Create a new chatwidget using the Tk window idpath. Any options provided are currently passed directly to the main chat text widget.
π WIDGET COMMANDS π
$widget topic command argsβ The chat widget can display a topic string, for instance the topic or name given to a multi-user chatroom or irc channel.showβ Enable display of the topic.hideβ Disable display of the topic.set topicβ Set the topic text totopic.
$widget name nick argsβ Control the names and tags associated with names.list ?-full?β Returns a list of all the user names from the names view. If?-full?is given then the list returned is a list of lists where each sublist is made up of the nick followed by any options that have been set on this nick entry. This may be used to examine any application specific options that may be applied to a nick when using theaddcommand.add nick ?options?β Add a nick with optional options.delete nickβ Delete a nick.
$widget message text argsβ Add messages to the display. options are-nick,-time,-type,-mark,-tags.$widget hook command argsβ Manage hooks.add(message,post names_group,names_nick,chatstate),remove,run.$widget names argsβ Passthrough to the name display text widget. See the text widget manual for all available commands. The chatwidget provides two additional commandsshowandhidewhich are used to control the display of this element in the widget.$widget entry argsβ Passthrough to the entry text widget. See the text widget manual for all available commands.$widget chat argsβ Passthrough to the chat text widget. See the text widget manual for all available commands.
π EXAMPLE π
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 http://core.tcl.tk/tklib/reportlist. Please also report any ideas for enhancements you may have for either package and/or documentation. ππ«Ά
π SEE ALSO π
β KEYWORDS β
chatchatwidgetcomposite widgetircmega-widgetwidget
Thatβs the whole page, bestie β from tklib, version 1.0.0, with chatwidget(n) energy all the way. πβ¨
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms