Escape sequences and clickable links |
The KVIrc view widgets support clickable links. The links can be created using special escape sequences in the text passed to the echo command. KVIrc uses some escape sequences in the text echoed internally. The simplest way to explain it is to use an example: |
echo This is a $cr![!dbl]echo You have clicked it! $cr\clickable link$cr ! |
The example above will show the following text line: "This is a clickable link".
If you move the mouse over the words clickable link, you will see the text highlighted. Once you double-click one of that words, the command echo You have clicked it! will be executed. The format looks complex?... it is not...just read on. |
<cr>!<link_type><cr><visible text><cr> <cr>!<escape_command><cr><visible text><cr> |
Escape format |
The whole escape sequence format is the following: |
<cr>!<escape_command><cr><visible text><cr> |
<cr> is the carriage return character. You can obtain it by using the $cr function. <visible text> is the text that will appear as link when you move the mouse over it. <escape_command> is the description of the actions to be taken when the user interacts with the link. |
The <escape_command> has the two following syntactic forms: <escape_command> ::= <user_defined_commands> <escape_command> ::= <builtin_link_description> |
User defined links |
The user defined links allow you to perform arbitrary commands when the user interacts with the link. The commands are specified in the <escape_command> part by using the following syntax: |
<escape_command> ::= <user_defined_commands> <user_defined_commands> ::= <command_rule> [<user_defined_commands>] <command_rule> ::= <action_tag><command> <action_tag> ::= "[!" <action> "]" <action> ::= "rbt" | "mbt" | "dbl" | "txt" <command> ::= any KVIrc command (see notes below) |
A shortcut |
You may have a look at the $fmtlink function: it does automatically some of the job explained in this document. |
See also |
$fmtlink $cr |