Introduction To Dialogs



A few words before I start

Dialogs were first introduced into mIRC in version 5.5. Dialogs are, simply put, a type of GUI - or graphical user interface. They are, to some, more complex than picture windows, and to others, like myself, easier. mIRC 5.51 brought along alot of bug fixes and improvements to dialogs. You should consult your versions.txt file for a full listing. mIRC 5.6 also contained a few minor changes. mIRC 5.61 gave us the ability to create tabs - but alas no coloured text yet.
Now we are at mIRC 5.7 with some more dialog features.

Dialogs can be difficult to grasp at first, but after a few attempts you will start to get used to it.

Creating a Dialog

Dialogs are opened using the /dialog command. Its basic format is: /dialog -switches name table. The name is simply what you want to use to refer to it in remotes. The table is the basis for the dialog - or simply put the building blocks. When creating a table, I prefer to use a modeless table (that is, it will not stop the script processing, and will operate independently of the script which called it). To create a modeless table, use the -m switch.

The table is placed in a remote file, with the prefix dialog. Inside it you need to put the commands to create the dialog, and put objects in it. Its format:

dialog tablename {
commands
}

All items put in the table require their own individual identifier tag (id for short). There are many items you can put in the dialog table. Most items put into a table requires an id. An id is just a way of assigning an item a name, which can then be used with the on DIALOG event, and the /did command. The id's do not have to be in sequential order. (i.e. not 1 2 3 4 5 etc...) but you will find it easier to organise your dialog that way. The lowest id you can use is 1 and the highest is 3000. Every id you put into the table has to be unique - so you cannot have two items in the table with an id of 7 as an example.

Its similar with real life. For example, parents give their children individual names. Now imagine a family with 5 children, all with no names - the parents would not know who is who. Now imagine if you have twins, and called them both Jeff? It is also likely to cause confusion.

A simple table requires at least 2 items.

Item Number 1: The Size. This item determines the basic shape of your dialog. Its similar to the xy wh values on the /window command. Its Format: size x y w h. If you want to put the dialog box in the centre of your screen, replace x and y each with -1. The w and h stand for the width and height of the dialog.

Item Number 2: An OK/Cancel Button. If not present, a dialog will not open. Its format is:

button "text",id, x y w h,style (The style can be default, ok, or cancel).

The x is the amount of distance the button should be placed, right from the top-left point of the dialog. The y is the amount of distance the button should be placed down from the top-left point of the dialog. The w is the width of the button, and the h is how tall the button is.

Item Number 3: The title. Quite simple to do. In your table put Title "text to use as a title". This item is not required, and if you leave it out the title will be "mIRC Input Request".

Now to apply these items to create our first dialog.

In remotes put:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
; this size creates a window in the middle (-1 -1) of the screen. It will be 300 wide and 100 tall.
  button "OK",1, 1 75 120 25, OK
; An OK or Cancel button IS required. I gave this button an id of 1. It will be placed 1 across, and 75 down from the
; top left of the dialog. It will be 120 wide, and be 25 tall. 25 is about the same size as a normal button.
}

Then to create the dialog, type /dialog -m first first
Something similar to the below should appear:

1) This is the OK button we made, (button "ok" etc...). It does not have to have OK as its name, you can change the text to whatever you wish. Its id is 1.

2) This is our title, (title "this is our first dialog"). You can change this at any time using the /dialog -t name text.
 
 

Putting Stuff onto the Dialog

Below is a list of various items that you can use in your table. Each item comes with an example. When attempting a new example, its recommended you remove any previous example (Do not remove the Title,Size and Button tag). To activate the example, type /dialog -m first first
 

Writing text onto a dialog:

This requires you to use the  item in the dialog table. Its format is: text "text",id,x y w h, style
The style is simply the way you want the text to be displayed - this is optional. The styles are:

Right: This puts the text as far right in its area as it can.
Center: This puts the text at the center of the area.
Tab <N>: Tells it which tab it should appear in if you want to place it in a tab.

By area I refer to the area defined by the w(idth) and h(eight).

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  text "Hello World",2, 1 1 100 25
}

View Image of Example
 

Creating a Button:

To insert a button you need to use the button item. Its format is: button "button text",id,x y w h,style

The styles are: ok,default,cancel
OK is just to designate that particular button as the OK button (though it does not need to say OK for the button text). It also closes the window.

Cancel is just to designate that particular button as the CANCEL button (though it does not need to say CANCEL for the button text). It also closes the window. When a user closes a dialog via its [x] button your cancel id is activated even though the actual button has not been pushed. To close the window without setting off remotes use /dialog -x dialog.

Default is to designate what button will be "pushed" when the user presses the enter key. This does not close the window.

You do NOT have to give every button a style.

Example:

Dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 5 120 25, OK
  button "Close",2, 1 35 120 25, CANCEL
  button "Default",3, 1 65 120 25, DEFAULT
  button "Other Button",4, 130 5 100 25
  button "Another Button",5, 130 35 100 25
  button "Press Me!",6, 130 65 100 25
}

View Image Of Example
 

Creating an Editbox:

The item to create an editbox is edit. Its format is: edit "text",id,x y w h, style
A typical editbox looks like:

The styles are:

Right, center, multi, pass, read, return, hsbar, vsbar, autohs, autovs, tab

Multi allows you to create a multi line edit box. (Just make your h value larger to add extra lines).
Pass gives the same effect as $?* - it changes text to * (password entry box).
Read makes the editbox uneditable, the area is shaded gray. This can be used for information windows.
Hsbar adds a horizontal scroll bar.
Vsbar adds a vertical scroll bar.
Autohs adds an "invisible" horizontal scroll bar that lets you keep typing past the length of the editbox.
Autovs is the same, except it uses a vertical scroll bar.
Return lets you put multiple lines of text into a multi editbox.

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  edit "Default Text",2, 10 30 150 20
}

View Image of Example
 

To add a Check Box:

Use the check  item. Its format is: check "text",id, x y w h,style
Its styles are: left, push, 3state, tab

Push: Creates a push button, not a check box.
3state: This creates a 3 state button: 1) unchecked 2) checked 3) Checked with gray background

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  check "3State Checkbox",2, 5 30 170 25,3state
}

View Image of Example

One advantage of using a 3 state checkbox is that you can "lock" certain settings on or off. To lock a setting on, using the checkbox example, in any mIRC window type /did -cu first 2.
 

To add a Radio Button:

Item needed: radio. Format: radio "text",id,x y w h,style
A typical radio button looks like:

Styles: left, push, tab

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  text "Select Gender:",2, 1 1 140 25
  radio "Male",3,1 20 60 25
  radio "Female",4,1 40 60 25
}

View Image of Example

You can also do groups of radio buttons, but this will be explained later.
 

Creating a Box (frame):

Item needed: box. Format: box "title text",id, x y w h,style
No known styles available except tab.

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  box "Script Info",2, 20 5 110 60
  text "Name: Dialog Script",3, 25 20 60 25
  text "Version: 1.0",4, 25 45 60 25
}

View Image of Example
 

Adding An Icon:

Item needed: icon Format: icon id, x y w h, filename, index, style
Styles: tab

The index is the picture number inside an icon file you wish to use. Usually icon files only have 1 icon in them, thus for your index you would use 1 or it can even be omitted. If you use Windows 95 (And maybe Win98/NT), a good index example is C:\WINDOWS\SYSTEM\PIFMGR.DLL (Substitute c:\windows for your windows folder).

The w and h designates an area in the dialog which the picture can be drawn in. If the picture is bigger than this area, then mIRC will shrink it down to fit in. The file does not need to have a .ico extension. What matters is that its in bitmap format.

Example:

dialog first {
title "This is our first dialog"
size -1 -1 300 100
button "OK",1, 1 75 120 25, OK
icon 2, 1 1 36 36, C:\WINDOWS\SYSTEM\PIFMGR.DLL,1
icon 3, 40 1 36 36, C:\WINDOWS\SYSTEM\PIFMGR.DLL,2
icon 4, 80 -1 36 36, C:\WINDOWS\SYSTEM\PIFMGR.DLL,5
}

The first icon line displays the first icon located in pifmgr.dll into an area 36 wide by 36 high.
The second icon line displays the second icon located in pifmgr.dll into an area 36 by 36.
The third icon line displays the fifth icon located in pifmgr.dll into an area 36 by 36.

We can change the image using the dialog command. The format to do so is: /did -g name id [n] filename
[n] is the optional index number. If the file only has one graphic - then [n] can be omitted (left out).

So if we wanted to change the first icon to lets say a picture of a keyboard, we would type:

/did -g first 4 12 c:\windows\system\pifmgr.dll

Don't have pifmgr.dll ? Click here - its part of windows.
View Image of Example

Another idea that I have been experimenting with is animations with dialogs. The Scripting Tips section dabbles into this.
 

Creating a Listbox:

Item needed: list Format: list id,x y w h, style
Typical List Box:

Styles: sort, extsel, hsbar, tab

Sort: Any text put into the list will be arranged in alphabetical order.
Extsel: Gives the listbox greater selection capabilities

To add text to the list, you need to use the did -a name id text command. You may use it as many times as you want. If you add more lines than there is visible space, a scroll bar will appear. The easiest way to create a list when a dialog is created is to use the on *:DIALOG:first:init:0: event. (This event will be explained later).

Example: In remotes put:

on *:DIALOG:first:init:0:{
;this event reacts when the dialog is created (init)
;then uses did -a to put some text into the item whose id is 2 (which is the list in this example)
   did -a first 2 Pear
   did -a first 2 Banana
   did -a first 2 Orange
   did -a first 2 Apples
   did -a first 2 Pineapple
}

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  list 2, 1 1 70 70, sort
}

Note that the text in the list has been sorted alphabetically.
View Image of Example
 

Creating a Combo:

Item needed: combo. Format: combo id,x y w h, style
Typical Combo:

Styles: sort, edit, drop, hsbar, tab
Drop: Creates a drop down box.

Example:

dialog first {
  title "This is our first dialog"
  size -1 -1 300 100
  button "OK",1, 1 75 120 25, OK
  combo 2,1 25 120 140,drop
  text "What Is Your Fav. Fruit?",3, 1 1 180 25
}

In Remotes put:

on *:DIALOG:first:init:0:{
;this event reacts when the dialog is created (init)
;then uses did -a to put some text into the item whose id is 2 (which is the combo in this example)
   did -a first 2 Pear
   did -a first 2 Banana
   did -a first 2 Orange
   did -a first 2 Apples
   did -a first 2 Pineapple
}

View Image of Example
 

Creating a Tab:

Item needed: tab. Format: tab "Tab Title",id,x y w h
Please be aware that you only have to specify the x y w h for the FIRST TAB. It sets the dimensions for any other tabs to come.

When you want to place other items into a particular tab, you need to use the tab <n> style. I usually place it at the end of all my styles for that particular item - so you can easily see what tab that item refers to. Example: We want to place a "Hello World" text item into a tab (lets say its tab 15). We could use:

text "Hello World",id,x y w h,right tab 15

This also means that somewhere earlier on in the dialog table we would have had a tab line. It should look similar to:

tab "Somename",15,x y w h

Example:

The source code can be found here. To open the dialog, I strongly advise you to type /dialog -mdo tab tab. Please note that its only a table, not actually a flood/repeat/clone kicker.

If you want to know what tab is currently selected, you need to use $dialog(dname).tab
 

What size was that?

mIRC 5.61 was released with a new sizing option - called option. It is an item in the dialog table, but I felt that I should explain it seperatly. You can omit this item and your dialog -should- appear as it used to. If you do include this item, you will probably need to rewrite some of the table. So why do it?
 

If you are concerned about consistency, then dbu is the way to go. If you wish, you can use the $dbuw and $dbuh identifiers to return dbu per pixel width and height.
 

Adding and Removing Text to an already created Dialog

This task requires you to use the /did command. Its basic format is: /did -switches name id [n] [text | filename]
Anything in []'s is optional. Since we want to add text to an item, we need to use the -a switch. We also need to know the id of the item we wish to add to. For example, we could rename the OK button using the did command. To do so, type (after opening a dialog):

/did -a first 1 Push This!

We used 1 because the OK buttons ID is 1. You are not limited to renaming buttons, you can also add text to most items. For example, in the last example (combo) if we wanted to change "What Is Your Fav. Fruit?" to "What Fruit Do You Hate The Most?" we would use the did command. I gave the "what fruit etc..." item an id of 3, so we need to include this in the did command.

/did -a first 3 What Fruit Do You Hate The Most?

If you try and change the text of an item, be sure that it will fit. The w value in most items sets the max length the text for that item can be. If you make a large h value, then if the text is to large, it will continue on a new line (Word Wrap).

Removing all text in an id is similar to adding text. Its format is: /did -r name id. Example (using the combo box example again). Open the dialog, then type /did -r first 2. Click on the combo box - it should have no listings.

But what if you wanted to delete just one listing? Then use the /did -d name id line-number command. Using the combo box again, type /did -d first 2 3. "Oranges" should have disappeared from the combo box.
 

Grouping Radio Boxes

Without groups, mIRC assumes every radio box in a dialog is related to each other. This means that in your whole dialog, you can only have one filled radio box. The solution? Group your radio boxes. Unlike remote groups, you do not specify a groupname, nor is the group started with #group on and ended with #group end. To start a group, for the style for the first radio button of a group you wish to make, enter group. Don't enter group as your style for any other radios in the group you want. These groups do not effect other items like check boxes. To start another group (and end the last group), simply put group as the style for the start of your next group. Sound confusing? It did to me. Perhaps an example will help (this uses the "first dialog" example):

dialog first {
title "This is our first dialog"
size -1 -1 300 100
button "OK",1, 1 75 120 25, OK
text "Gender:",2,1 1 60 25
;this is the start of the first group
radio "Male",3,50 1 50 20,group
radio "Female",4,100 1 60 20
text "Marital Status:",5,1 25 120 25
;this second group starter automatically ends the first group
radio "Single",6,70 20 50 25,group
radio "Married",7,125 20 60 25
radio "Other",8,190 20 60 25
text "Age:",9,1 45 30 25
;this next group also tells the script that the last radio item before this group was the last item for the last group
;yes i know - a tongue twister.
radio "Under 10",10,30 40 65 25,group
radio "10 to 20",11,100 40 65 25
radio "Over 20",12,165 40 65 25
}

View Image of Example

The first group for this table starts at id 3, and ends with id 4.
The second group starts at id 6, also contains 7 and 8.
The third and last group starts with id 10, and also has 11 and 12 in it.

There are more group examples in gui-kick.txt which can be found in the "Other Dialog Scripts/Examples" section.
 

More Appearance changes (Part 1)

Not only can you add and remove text from the dialog, you can also hide/show, focus/unfocus, enable/disable, check/uncheck + more. Most of these changes are made with the /did command. But before I can explain them properly to you, you need to know more about the on DIALOG event. The on DIALOG event reacts whenever something happens which effects any item in a dialog. Its format is:

on *:DIALOG:name:event:id:

When activated, the on DIALOG event allows you to use three new identifiers, $dname, $devent, and $did. $dname stands for the name of the dialog which activated the event. $devent stands for the event. $did stands for the id of the item effected.

There are several different types of events: init,sclick,edit,dclick.

init: reacts just before a dialog is displayed, controls can be initialized in this event. id is zero.
edit: reacts when text in editbox or combo box changed.
sclick: reacts when a single click in list/combo box, or check/uncheck of radio/check buttons, or click of a button occurs.
dclick: reacts when a double click in list/combo box occurs.

If you wish to debug your dialog use the following:

on *:DIALOG:name:*:*: {
;this is nearly a copy/paste from the help file.
   echo $dname $devent $did
}

For the following explanations, example dialogs will based upon the text file, dialog.txt (6.1kb). Please download this file first, and load (or copy paste) it into your remotes. To create the dialog, type /ss (Its a custom alias included in dialog.txt). When you type /ss, a dialog similar to the image below, should appear.

Now back to changing appearances. Below is a list of the majority of changes you can do, with its command and example. Also, since mIRC 5.6, the /did command can now do multiple id's in one line. So you could check multiple checkboxes using /did -c dname id1,id2,id3,id4,etc... Guess this kills my mdid aliases :(.

Checking/Unchecking A Check/Radio/Combo Box:

If you wish to tick/fill/highlight a check/radio/combo box, the command you will need is the /did -c command. Its format is: /did -c name id [number]. The [number] is only used for checking combo boxes.

Examples:

To check the "Join Channels On Connect" checkbox, open the dialog (type /ss) and in your status window type:
/did -c setup 18

To put a dot in "Male" in the Gender selection, open the dialog, and in the status window type:
/did -c setup 11

To highlight a channel in the Favorites List, open the dialog, and in the status window type:
/did -c setup 14 2

This should highlight the second favorite channel in your list. If it does not, then you have not set a second favorite channel.

If you wish to untick/unfill a Check/Radio Box, then the command you should use is the /did -u command. Its format is: /did -u name id

If you wish to select a line in a drop down combo, then the command you should use is the /did -c command. Its format is: /did -c name id

Examples:

To uncheck the "Join Channels On Connect" checkbox, in your status window type:
/did -u setup 18

If you are using a 3state checkbox, then by using -cu as your switch, it grays the check box (Makes it intermediate).

To remove the dot (unfill) in Male in the Gender selection, in your status window type:
/did -u setup 11

Selecting Text in A Edit Box:

If you want to select some specific text in an editbox and are using mIRC 5.7 or higher you can do so using the /did -c command. The format you want to use is:

/did -c dname id [n] [start [end]]

This lets you select the N'th line in an editbox (and thus scroll down to the selected text). If you want you can select just a portion of the text of that line using the [start [end]] values. Start is the location of the first character to select - e.g. 5 would start the selected at the 5th character. If your end value exceeds the total length of the line then mIRC will just keep highlighting until it highlights as many characters as you specified in your end value.
 

Adding/Removing Focus on an item:

To put a Focus on an item is to basically add a thin dotted line around the item (Like in "Join Channels On Connect" in the above image).

The format to add focus to an item is: /did -f name id.
The format to remove focus from an item is: /did -t name id.

Examples:

To place focus on the "Add Chan" button, type /did -f setup 14
To remove the focus from "Add Chan", type /did -t setup 14

Enable/Disable Items:

When you disable an item, it appears grayed out. To remove this gray use the enable command.

To disable an item: /did -b name id
To enable an item (which is disabled): /did -e name id

Examples:

To disable the "Remove Chan" button, in your status window type:
/did -b setup 16

To enable the "Remove Chan" button, in your status window type:
/did -e setup 16

One exception to this command are editboxes, which instead of -b to disable use -m, and they use -n to enable.

Hiding and Showing Items:

By hiding items, you can effectively have different dialogs in one dialog window. You can hide the ok button if you only to use the window for display purposes (Like channel stats). Or lets say you have a survey dialog, you could hide every question, and only show the current one - this way you can cut down on the amount of monitor space the dialog takes up. You could also display different sections of a setup screen using the hide commands. Of course these are just a few ideas - I know there are many more.

To hide an item, type /did -h name id
To show an item, type /did -v name id

Examples:

Lets say we don't want the person using the Script Setup dialog to use the "Join Chan" button, in the status window type:
/did -h setup 17

Or if we want to make it visible again, in the status window type:
/did -v setup 17
 

More Appearance changes (Part 2)

Now you ask: "But I want to do these changes automatically, HOW?". This is where the on DIALOG event comes in again. Like I said before, the on DIALOG event reacts when certain things happen with the dialog window. If you wanted to change the appearance of some items when the dialog is first loaded, then use: on *:DIALOG:name:init:0: commands.

This is also how you can insert variables/identifiers into a dialog as the /did and /dialog command both evaluate variables and $identifiers.

This example can be found in dialog.txt:

on *:DIALOG:setup:init:0: {
;setup is the name of the dialog. init is the event that occurs when the dialog is first created. 0 is the default id for when
; an init occurs.
  did -a setup 21 < 5
  did -a setup 21 5 to 9
  did -a setup 21 10 to 14
  did -a setup 21 15 to 19
  did -a setup 21 20 to 24
  did -a setup 21 25 to 29
  did -a setup 21 29 to 34
  did -a setup 21 34 to 38
  did -a setup 21 38 to 42
  did -a setup 21 43+
;those did -a's add items to the drop down combo that selects your age.
;this is how you add text to a combo (both normal and drop down).
  if (%setup.connect == $null) { set %setup.connect off }
  if (%setup.connect == on) { did -c setup 18 }
;this did -c checks the "Join Channels On Connect" if you had previously ticked it
  if (%setup.nick != $null) { did -a setup 5 %setup.nick }
;if you had already filled in a nick then this will display it
  if (%setup.alt != $null) { did -a setup 7 %setup.alt }
;if you had already filled in a alt. nick then this will display it
  if (%setup.real != $null) { did -a setup 9 %setup.real }
;if you had already filled in a real name then this will display it
  if (%setup.gender == male) { did -c setup 11 }
; if you selected male as the gender, then did -c setup 11 will put a dot in the male radio box
  if (%setup.gender == female) { did -c setup 12 }
; if you selected female as the gender, then did -c setup 12 will put a dot in the female radio box
  update.setup
;update.setup is a custom alias that adds all the favorite channels to the fav. channels combo.
}

When someone does a single click (sclick) on an item in a dialog, the dialog event sclick is activated.
The $did identifier stands for the id of the item that was just clicked on.

If the sclick was on a checkbox an easy way to tell what state the checkbox is now in, is to use $did(id).state. If the checkbox is checked, it will return 1, if it is unchecked it will return 0. If the checkbox is intermediate, then it will return 2.

There is an sclick dialog event in dialog.txt

When someone types/removes text in an edit box, the dialog event EDIT is activated. When used in an on DIALOG event, $did(id).text will return the text in the editbox. An example of this can also be found in dialog.txt

There are many other things you can do with the $did identifier. They are listed in /help dialogs.
The dialog.txt file is annotated to help you understand dialogs a bit better.

NOTE: In mIRC 5.51 you can now insert %variables into certain parts of a dialog table. As quoted from the versions.txt:
"74.Can now use %variables in dialog table definitions for certain items:    title, size, "text", id, and icon name and n index."
 

The $Did Identifier:

The did identifier is not the /did command (like $nick is not /nick). As you may already know, the $did identifier is used to return information about certain aspects of the dialog.

It can, among things, return the text you selected in a listbox, the current state of a checkbox or radio, and even the length of text. Its basic format is:

$did(dialog-name,id,N).property

Though when you use this identifier within a dialog event the dialog-name can be omitted.

Below is a list of possible uses, some with examples. All the examples are based upon the Script Setup dialog (/ss). I have put //echo -a in the examples for ease of use purposes but you do not have to use //echo -a as its just an identifier after all.

Am I Invisible?:

With the release of mIRC 5.6, the $did identifier now supports two new properties. .visable and .enable. The .visable property will return $true if the specified id is visable (/did -v dname id), if not, it will return $false. The .enable property will return $true if the specified id is enabled (/did -e dname id), if not, it will return $false.

Visable Format:

$did(dialog-name,id).visable

Enable Format:

$did(dialog-name,id).enable
 

Returning the Text in a Dialog Item:

This text can be the name on a button, the n'th word in a listbox or what have you. The basic format is:

$did(dialog-name,id,N).text

N is optional, as some id's like a Close button may only have one line of text. Things like the listbox can have more, thus the N value is needed.

Examples (Using the Script Setup Dialog):

//echo -a $did(setup,5).text

This will return a nickname if it was entered in the edit box (id number 5).

If you wanted to return the text  in the auto join combo editbox, you would use:

//echo -a $did(setup,14).text
 

Returning the Selected Text in a Dialog Item:

By selected text, I mean when you select something with a mouse in, say, a listbox or combo.
The format is:

$did(dialog-name,id,$did(dialog-name,id).sel).text

The $did(dialog-name,id).sel returns the number of the selected line. $did().sel is explained futher on in this intro.

Examples:

To return the line number selected in the "AGE" drop down combo, use:

//echo -a $did(setup,21).sel

Now to return the text that the line holds, use:

//echo -a $did(setup,21,$did(setup,21).sel).text

Returning the Length of Text:

To return the length of text a line holds, I use the following format:

$did(dialog-name,id,N).len

When getting the length of an editbox or combo, you should always specify the line number, even if the item is only one line. Of course if you wanted to, you could always just use $len($did(dialog-name,id,N).text) but $did().len takes up less space.

Examples:

To return the length of text in the nickname editbox (id 5) use:

//echo -a $did(setup,5,1).len

To return the length of the 2nd channel in the combo box (id 21) use:

//echo -a $did(setup,21,2).len

Returning the Number Of Lines of Text:

To return the number of lines of text in an item such as a listbox, you should use the .lines property, its format is:

$did(dialog-name,id).lines

Examples:

//echo -a $did(setup,14).lines

This will return the number of channels you have in your "auto join on connect" combo.

Returning the State of a Checkbox or Radio:

I consider this one of the most important properties for $did. To see if a checkbox is checked, or if a radio has a dot in it, you need to use the .state property. Its format is:

$did(dialog-name,id).state

If the checkbox or radio is filled, then $did(dialog-name,id).state will return 1. If the item is not filled then it will return 0. If the item is not a checkbox or radio then it will return nothing (i.e. == $null).

Examples:

//echo -a $did(setup,11).state

This will return 1 if you checked male as your gender, or 0 if did not.

//echo -a $did(setup,18).state

This will return 1 if you checked the "Join Channels On Connect" checkbox, or 0 if its unchecked.
 

DidTok:

Didtok is something new to mIRC 5.7. It consists of an identifier ($didtok) and a command /didtok. As you can probably guess by the name, it is related to Tokens. It is basically an easy way of placing data into a list/combo/editbox and reading the data in the form of a tokenized list. To help explain I will use the Setup Dialog example.

/DidTok:

This identifier is used to put some text into a combo/list/editbox. Each part of the tokenized text will be placed on its own line. So in the setup dialog, instead of having to use

  did -a setup 21 < 5
  did -a setup 21 5 to 9
  did -a setup 21 10 to 14
  did -a setup 21 15 to 19
  did -a setup 21 20 to 24
  did -a setup 21 25 to 29
  did -a setup 21 29 to 34
  did -a setup 21 34 to 38
  did -a setup 21 38 to 42
  did -a setup 21 43+
everytime we want to add all those age values to the combo, we can use

/didtok setup 21 46 < 5.5 to 9.10 to 14.15 to 19.20 to 24.25 to 29.29 to 34.34 to 38.38 to 42.43 +

Now let me explain the format for this command. It is:

/didtok dname id C text

The 46 that I used is the ASCII value for a period (.). 21 was the id of the combo to put the text into, and the blue text is the tokenized text. Note how each 'line' in the combo box is actually in this text, but seperated with a period. To use this you really need to learn about tokens first.
 

$DidTok:

This identifier does the opposite of /didtok. It returns the text in a combo/list/editbox in the form of one line, with each line from the combo seperated by the other lines by a common character (C). Its format is as follows:

$didtok(dname,id,C)

So if we wanted to return the favourite channels in our setup dialog (/ss) we could use the following:

//echo -a $didtok(setup,14,46)

This will return the channels in your 'favourites' combo, each seperated by a period (46 is the ascii value for a period).

See, now you have a fast and easy way of storing and retrieving groups of data without having to use loops or anything complex (*sigh* shame it wasn't with us all along).

Other Dialog Commands:

Here are some of the other commands/switches I have not explained yet:

Makes the dialog a desktop dialog: /dialog -d name
Changes the dialogs title: /dialog -t name TITLE
Changes the size of the dialog: /dialog -s name x y w h (good for animations, see dialog-fx alias)
Makes the dialog be onto of all windows: /dialog -o name
Removes the ontop setting: /dialog -n name
Clicks the ok button (thus closing window): /dialog -k name
Clicks the cancel button (thus closing window): /dialog -c name
Makes the dialog become the active window: /dialog -v name
Closes the dialog without activating any events: /dialog -x name
Centers the dialog: /dialog -r name
Minimize or Restore a desktop dialog: /dialog -ie name

Insert text into item: /did -i name id line
Overwrite text in item: /did -o name id line text
Reset the width of a hsbar: /did -z name id

Other Dialog Identifiers:

This section is made to cover the new dialog related identifiers added in mIRC 5.7.

$didwm(name,id,wildtext,N):

This identifier "returns the number of the line that matches wildtext, with the search starting at line N, N is optional.". So for instance if you wanted to find what line "25" is on in the Setup dialog that we made, we would use something like:

 //echo -a $didwm(setup,21,*25*)

It should return 6. I know that this seems like a bad example, as I really can't think of anything good to do with it that /filter could not.

$did().seltext:

This identifier is used to return the selected text in an editbox.

$did().selstart:

This identifier is used to return select start character in editbox line

$did().selend:

This identifier is used to return select start character in editbox line

For the above three identifiers, I can't see much use for them, although if you are using voice commands with you script it could become handy for 'editing' text, e.g. 'delete selected text" or "select text" (Using did -c) etc...

$did().edited:

Depending on if the text in an editbox has changed, this identifier will either return $true (yes it has been changed) or $false (no it hasn't). You can reset this (i.e. so mIRC thinks the text has not changed) by using the /did -j switch.
 

Other Dialog Resources:
 

paiRC Dialog Tutorial:

paiRC contains many useful resources and not to mention many scripts. The dialog tutorial can be found in the Tutorial Section of the Scripting Tips area.

Dialog Pointers From MIMP:

This file - actually a copy of an email - composed by MIMP talks about various ways to do dialogs (pointers).

Ntd's Dialog Design:

Found in mIRC.net. This is document explains good dialog design techniques to achieve good looking and functional dialogs.
 
 

Return to the Documentation Section Front

Release 6 Written by Pasmal
Additional Infomation provided by MIMP
Additional Script Example provided by PsychoGuy
Latest mIRC version at time of release: 5.61
Copyright © 1998,1999 #HelpDesk, All rights reserved.