From WikiChip
mirc/dialog components
< mirc
Revision as of 17:11, 23 December 2013 by David (talk | contribs)

Template:mIRC Guide Dialog Components are individual dialog elements that can be added onto the main dialog window. Below is a list of all the natively provided dialog components in mIRC.

Components

Button

The button control is user interface control that responds to click events.

Syntax

button "<text>", <id>, <x> <y> <width> <height>[, <style>]

Styles

Style Description
default Sets the button to be the default button. This causes the button to be selected upon dialog creation.
ok Sets the button to be the OK button. The OK button closes the dialog and in modal mode returns the return value set.
cancel Closes the dialog as if it was canceled – similar to clicking the X button.
flat Creates a flat button (that depends on the OS and the theme used).
multi Allows the text in the button to wrap around to multiple lines.
disable Disables the button.
hide Makes the button invisible.
result In modal mode, returns the text of the button.

Events

Event Description
sclick Triggers upon a single click

Example

; init alias
alias example {
  dialog -m example example
}
; dialog structure
dialog Example {
  title "WikiChip - Example"
  size -1 -1 100 50
  option dbu
  button "Example 1", 1, 4 10 40 12
  button "Example 2", 2, 50 10 40 12
  button "Example A", 3, 4 30 40 12
  button "Example B", 4, 50 30 40 12, ok
}
; event
on *:dialog:example:sclick:1-4:{
  echo -a $did($dname, $did).text is clicked.
}

Check

The checkbox control is user interface element that permits the user to select or unselect an option. The checkbox control is a combination of a check box and a label. The mIRC check control has three states: Checked, Unchecked, and Indeterminate.

Syntax

check "<text>", <id>, <x> <y> <width> <height>[, <style>]

Styles

Style Description
push Used for Toggle Buttons
left Places the text on the left side of the control.
3state Enables Indeterminate State.
multi Allows the text in the check box to wrap around to multiple lines.
disable Disables the check box.
hide Makes the check box invisible.
result In modal mode, returns the text of the check box.

Events

Event Description
sclick Triggers upon a single click

Example

; init alias
alias example {
  dialog -m example example
}
; dialog structure
dialog Example {
  title "WikiChip - Example"
  size -1 -1 100 50
  option dbu
  check "Example 1", 1, 4 10 40 12, 3state
  check "Example 2", 2, 50 10 40 12
  check "Example 3", 3, 4 30 40 12
  button "Done", 4, 50 30 40 12, ok
}
; events
on *:dialog:example:init:0:{ 
  did -cu $dname 1
  did -c $dname 2
}
on *:dialog:example:sclick:1-3:{
  echo -a $did($dname, $did).text is clicked. $&
    State: $dstate $+ .
}
alias -l dstate {
  var %s UnChecked Checked Indeterminate
  return $gettok(%s, $calc($did($dname, $did).state + 1), 32)
}

Combo

The combo control provides a way choose an item from a selection of item in either a list of drop-down fashion.

Syntax

combo <id>, <x> <y> <width> <height>[, <style>]

Group

This is a static control with a group box frame and an optional title that shows up at the top of the frame.

Syntax

box "<title>", <id>, <x> <y> <width> <height>[, <style>]

Image

A image control is a simple container that holes images and icons.

Syntax

icon <id>, <x> <y> <width> <height>[, <filename>[, <index>]], <style>

Label

A label is simply a gui component with text designed for displaying information with no user input. By default, the text will wrap to the next line if needed.

Syntax

text "<text>", <id>, <x> <y> <width> <height>[, <style>]

Link

A link control, just like a label, is a static control with the additional behavior that when clicked opens the URL in the default web browser.

Syntax

link "<URL>", <id>, <x> <y> <width> <height>[, <style>]

List

The list control provides a way to display a list of items.

Syntax

list <id>, <x> <y> <width> <height>[, <style>]

Menu

A menu control that allows a hierarchal organization of elements called menu items.

Syntax

menu "<text>", <menuid> [, <menuid>]
item "<text>", <id [, <menuid>]
item break, <id [, <menuid>]

Radio

Radio buttons are a group of controls that allow the user to choose only one of a predefined set of options.

Syntax

radio "<text>", <id>, <x> <y> <width> <height>[, <style> [group]]

Scroll

A scrollbar is a simple component that can be used to scroll something. A scrollbar operates within a given range.

Syntax

scroll "<text>", <id>, <x> <y> <width> <height>, <style>

Tab

A tab control is a container component capable of holding all the other components inside it. A tab control can have multiple tabs, each can store another set of controls.

Syntax

tab "<text>", <id>, <x> <y> <width> <height>, <style>
tab "<text>", <id>, <style>

Toggle Button

A toggle button is specialized button control which has the ability to be selected. Like a checkbox control it has a checked and an unchecked state. A toggle button cannot have a third state.

Syntax

check "<text>", <id>, <x> <y> <width> <height>, push[ <style>]

Text

The edit control can behave as a normal text box as well as a rich text control.

Syntax

edit "<text>", <id>, <x> <y> <width> <height>[, <style>]