1chatwidget(n) Composite widget for chat applications chatwidget(n)
2
3
4
5______________________________________________________________________________
6
8 chatwidget - Provides a multi-paned view suitable for display of chat
9 room or irc channel information
10
12 package require Tk 8.5
13
14 package require chatwidget ?1.0.0?
15
16 ::chatwidget::chatwidget path ?options?
17
18 $widget topic command args
19
20 $widget name nick args
21
22 $widget message text args
23
24 $widget hook command args
25
26 $widget names args
27
28 $widget entry args
29
30 $widget chat args
31
32______________________________________________________________________________
33
35 This is a composite widget designed to simplify the construction of
36 chat applications. The widget contains display areas for chat messages,
37 user names and topic and an entry area. It automatically handles
38 colourization of messages per nick and manages nick completion. A sys‐
39 tem of hooks permit the application author to adjust display features.
40 The main chat display area may be split for use displaying history or
41 for searching.
42
43 The widget is made up of a number of text widget and panedwindow wid‐
44 gets so that the size of each part of the display may be adjusted by
45 the user. All the text widgets may be accessed via widget passthrough
46 commands if fine adjustment is required. The topic and names sections
47 can also be hidden if desired.
48
50 ::chatwidget::chatwidget path ?options?
51 Create a new chatwidget using the Tk window id path. Any options
52 provided are currently passed directly to the main chat text
53 widget.
54
56 $widget topic command args
57 The chat widget can display a topic string, for instance the
58 topic or name given to a multi-user chatroom or irc channel.
59
60 show Enable display of the topic.
61
62 hide Disable display of the topic
63
64 set topic
65 Set the topic text to topic.
66
67 $widget name nick args
68 Control the names and tags associated with names.
69
70 list ?-full?
71 Returns a list of all the user names from the names view.
72 If ?-full? is given then the list returned is a list of
73 lists where each sublist is made up of the nick followed
74 by any options that have been set on this nick entry.
75 This may be used to examine any application specific op‐
76 tions that may be applied to a nick when using the add
77 command.
78
79 add nick ?options?
80
81 delete nick
82
83 $widget message text args
84 Add messages to the display. options are -nick, -time, -type,
85 -mark -tags
86
87 $widget hook command args
88 Manage hooks. add (message, post names_group, names_nick, chat‐
89 state), remove, run
90
91 $widget names args
92 Passthrough to the name display text widget. See the text widget
93 manual for all available commands. The chatwidget provides two
94 additional commands show and hide which are used to control the
95 display of this element in the widget.
96
97 $widget entry args
98 Passthrough to the entry text widget. See the text widget manual
99 for all available commands.
100
101 $widget chat args
102 Passthrough to the chat text widget. See the text widget manual
103 for all available commands.
104
106 chatwidget::chatwidget .chat
107 proc speak {w msg} {$w message $msg -nick user}
108 .chat hook add post [list speak .chat]
109 pack .chat -side top -fill both -expand 1
110 .chat topic show
111 .chat topic set "Chat widget demo"
112 .chat name add "admin" -group admin
113 .chat name add "user" -group users -color tomato
114 .chat message "Chatwidget ready" -type system
115 .chat message "Hello, user" -nick admin
116 .chat message "Hello, admin" -nick user
117
118
119 A more extensive example is available by examining the code for the pi‐
120 coirc program in the tclapps repository which ties the tcllib picoirc
121 package to this chatwidget package to create a simple irc client.
122
124 text(n)
125
127 chat, chatwidget, composite widget, irc, mega-widget, widget
128
129
130
131chatwidget 1.0.0 chatwidget(n)