ChatLogTemplate
ChatLogTemplate creates a container with a chat log view and an entry that sends chat lines and commands. For a higher level version see chatareatemplate2
Description
This function returns a table with the following fields:
chatentry
Entry control for entering chat lines and commands
To send messages the "active" field must be set to "yes"
The "type" field must be set to a chat type accepted by SendChat
chattitle
Label left of chatentry. Displays chat type in HUD.
chattext
Multiline control with chatlog
log
assigned chatlog (_generalchatlog, _missionchatlog, _stationchatlog or nil)
vbox
chatarea control
update_cb
Callback passed to [[API_Index#ChatLogTemplate|]]
The function receives this table as argument
It should set the "updated" field in the assigned chat log to false. This indicates that the log was displayed. SetChatLogRead, SetMissionLogRead and SetStationLogRead take care of that for their respective logs.
Example
<source lang="lua"> -- minimal chat dialog
-- create chat container local c = ChatLogTemplate("255 0 0 100", "0 255 0 100" , SetChatLogRead, IMAGE_DIR.."commerce_tab_bgcolor.png", true) -- create dialog and put container into it local d = iup.dialog{c.vbox, size="400x200", topmost="yes"}
-- tell entry to send channel messages c.chatentry.type = "CHANNEL" -- activate entry c.chatentry.active = "yes"
-- point the general chat, advancement or station log to this container SetChatLogReceiver(c) -- SetMissionLogReceiver(c) -- SetStationLogReceiver(c)
-- show the whole thing d:show() </source>