Creating dialogs in mIRC isn't very hard, Think of a dialog that appears, Where you add some caption text, some objects etc. Buttons, Edit box, List box. And specify positions, and size.
There are 2 types of dialogs, a modeless dialog is a dialog, triggered by command, and a modal dialog, is called via the $dialog identifier. All dialog events, and table goes to Remote (Alt+R).
The structure of a dialog looks like this:
Dialog name {
Title "title text of a dialog"
Size x y w h
Icon filename, index
Option dbu,pixels,notheme
Objects
}
The 'dialog name {' is the starts out structure of youre table, showing youre tables name. The Title "text", function is for setting the caption of youre dialog, this will appear in the title bar of your dialog. The size function is for setting position coordinates and width / height. Icon function is for setting the icon for your dialog, using index will use the specified number in an icon library or application (where ever)
Now the option function is the dialogs appearance, pixels is default, but dbu will make sure the dialog appears the correct size on other peoples machines; notice there's a difference of size in pixels, and dbu when giving a size for youre buttons, list boxes, etc.
Objects as I prefer to call them are such things as buttons and so on. Almost all objects has this syntax: Object "text", ID, x y w h, style
All Objects have IDs, which is a number, the number is unique, meaning it can only, and I mean only be used once, If youre using the same number twice, or more. You won't even be able to execute youre dialog. Also all dialogs must have an OK, or Cancel button, but these buttons can be disabled, and hidden.
The x y are position coordinates, where the objects will be placed on youre dialog. W and h are width, and height. Meaning the size of youre object, the style specified at the end, is the style for the object, in for example you can set a buttons style to be flat, and not having the raised look/appearance.
All of youre dialog performance, etc. a click on a button, double click on a list box, will be parsed out trough youre on DIALOG event, I have included some examples that should get you started, You only really need to know, how to handle the events. Since dohcan, from mircscripts.org, the mirc resource site, has released a very good dialog designing application, which allows you to design youre dialog, as you are looking at it. Defiantly something you should try out, you can get Dialog Studio at http://www.mircscripts.org/dstudio/dstudio.html
Here an example you can play around with, if you dont understand anything right away, dont give up, dialogs in the start can be confusing, but they are actually very easy.
Example (everything goes to remote, alt+r)
; Dialog table.
Dialog example1 {
Title "example 1"
Size -1 -1 190 200
Button "OK", 1, 10 165 80 25, ok
Button "Cancel", 2, 100 165 80 25, cancel
List 3,10 10 170 150
}
; dialog events.
On *:DIALOG:example1:*:*:{
; $devent returns the event which is happening, in this case it checks if its init
; init is the initial, which executes on startup, $did returns the dialog id
; since the dialog it self, doesnt have an ID, and only a name, $did returns 0.
If ($devent == init) && ($did == 0) {
; Lets add something to our list box, id number 3
; the /did -a function, requires the dialog name, and id object
; To add text to, $dname is the parent dialog, and you're list box id is 3
did -a $dname 3 One!
did -a $dname 3 Two?
did -a $dname 3 Three..
}
; sclick is single click, on id 1 (the OK button)
if ($devent == sclick) && ($did == 1) {
echo -a you clicked ok!
}
; dclick is double click, on id 3, which is the list box.
if ($devent == dclick) && ($did == 3) {
echo -a you selected line number: $did($dname,3).sel in the list box.
}
}
? Discuss This Article here.
|