DCX - Dialog Control Xtension

Tutorial MDX
Very Basic
Teaches:- Basic structure of MDX initialisation procedure
- How to recognise events for specific controls
Script by BLKoldSUN
;// the entry function to create a normal mIRC dialog

menu channel {
	Tutorial MDX: { dialog -m example example }
alias mdxexample { dialog -m example example }
dialog example {
	title "Example"
	size -1 -1 1000 18
	option dbu
	list 1, 1 2 1000 14, size

on *:dialog:example:init:0:{
	;You must ALWAYS do this if you are going to use mdx on a control or dialog
	;This tells mdx your mIRC version and the dialog you will be adding controls to
	dll mdx.dll SetMircVersion $version
	dll mdx.dll MarkDialog $dname
	;This sets the desired listbox control to a toolbar control, we will look at the different styles later
	dll mdx.dll SetControlMDX $dname 1 ToolBar list arrows flat wrap nodivider > bars.mdx
	;Takes away the dialog's titlebar and border and takes off the control's border
	dll mdx.dll SetDialog $dname style
	dll mdx.dll SetBorderStyle 1
	;Sets icon size
	did -i $dname 1 1 bmpsize 16 16
	;Adds icon IDs to the control
	did -i $dname 1 1 setimage icon small icon1.ico
	did -i $dname 1 1 setimage icon small icon2.ico
	;Adds items into the control
	;The bolded +a is called a FLAG - we will go through them later
	;The bolded 1 is the icon ID that we set previously, using 1 will return icon1.ico, using 2 would return icon2.ico
	;The bolded Hello is item's text, this can have a value or be left blank
	;The bolded Tooltip! is the items tooltip, this text will appear when you hover over the item
	did -a $dname 1 +a 1 Hello $chr(9) Tooltip!
	did -a $dname 1 +a 2 Goodbye $chr(9) Tooltip!
	;use this if you want to dock the dialog over mIRC's default
	dll ktools.dll DockToolbar $dialog($dname).hwnd

;this is the event that will determine which button you clicked and what it will do
on *:dialog:example:sclick:1:{
	;Sets %click to the ID that you clicked, the first toolbar item will return 2
	var %click $did($dname,1).sel
	;Checks if %click is the same as the selected item
	if (%click == 2) {
	;Command you want to use goes here!
	elseif (%click == 3) {
	;Command you want to use goes here!
© 2005-2021