| Home | Translations | Download | Forum | Bug Tracker

|  | v1.3.7

Tutorials
DCX offers a diverse number of additional controls to mIRC dialogs. It also offers many exciting new features to existing mIRC controls which allow you more flexibility and creativity within your dialog designs. We strive to keep DCX as easy to use as possible, but we also recommend you have a strong understanding of mIRC dialogs before venturing into the world of DCX. Once you feel you are ready, its time to say hello world :)
Tutorials
Command: | /very_basic
Teaches: | - Basic structure of DCX initialisation procedure - How to recognise events for specific controls
Script by twig*
    ;// the entry function to create a normal mIRC dialog
    ;// this creates a dialog called "very_basic" using the table "very_basic_table"
    alias very_basic {
    	dialog -ma very_basic very_basic_table
    }

    ;// this is the table which we are using
    dialog very_basic_table {
    	title "Very Basic"
    	size -1 -1 173 31
    }

    ;// this is the normal mIRC dialog event handler, for the "very_basic" dialog
    on *:dialog:very_basic:*:*: {
    	;// on the initialise event...
    	if ($devent == init) {
    		;// call DCX Mark to specify which dialog you are marking, and the callback function "very_basic_cb"
    		dcx Mark $dname very_basic_cb

    		;// Creating a button with the ID #1 at position (5, 5) with the width of 75x20 pixels
    		xdialog -c $dname 1 button 5 5 75 20
    		;// Label the button(#1) with the caption "Hello"
    		xdid -t $dname 1 Hello

    		;// Creating a button with the ID #2 at position (90, 5) with the width of 75x20 pixels
    		xdialog -c $dname 2 button 90 5 75 20
    		;// Label the button(#2) with the caption "Close"
    		xdid -t $dname 2 Close
    	}
    }

    ;// Callback alias for "very_basic"
    ;// The basic format of callback parameters are:
    ;// Parameter $1 = the dialog name (ie. very_basic)
    ;// Parameter $2 = the event name (ie. sclick)
    ;// Parameter $3 = the ID of the control for which the event occurred (ie. ID #1)
    alias very_basic_cb {
    	;// If the event was a single click on the dialog (ID is #0 for a dialog event)
    	if (($2 == sclick) && ($3 == 0)) {
    		echo -s You have clicked on the dialog!
    	}
    	;// If the event was a single click on the hello button (remeber the ID is #1 for the hello button?)
    	else if (($2 == sclick) && ($3 == 1)) {
    		echo -s You have clicked on the Hello button!
    	}
    	;// If the event was a single click on the close button (remeber the ID is #2 for the hello button?)
    	else if (($2 == sclick) && ($3 == 2)) {
    		xdialog -x $1
    	}
    }
Tutorials
Command: | /box_styles
Teaches: | - How to use DCX styles on controls - Use of $xdid().properties - Demonstrating use of /xdialog -b (border command)
Script by twig*
    alias box_styles {
    	dialog -ma box_styles box_styles_table
    }

    dialog box_styles_table {
    	title "Box Styles"
    	size -1 -1 326 222
    }

    on *:dialog:box_styles:*:*: {
    	if ($devent == init) {
    		dcx Mark $dname box_styles_cb
    		;// Notice that this line is new. This is changing the border style of the "box_styles" dialog
    		;// to have a titlebar and a little X in the top right corner.
    		;// Look up /xdialog -b in the DCX documentation for more information.
    		xdialog -b $dname +ty

    		;// Call initilisation alias. This simply puts all the control creation into another alias for neatness.
    		box_styles_init_dcx
    	}
    }

    alias -l box_styles_init_dcx {
    	;// Initialising control: Box #1 - no styles (default is top left)
    	xdialog -c $dname 1 box 5 5 150 100
    	xdid -t $dname 1 Box 1: Top Left

    	;// Initialising control: Box 2 - "right" style
    	xdialog -c $dname 2 box 165 5 150 100 right
    	xdid -t $dname 2 Box 2: Top Right

    	;// Initialising control: Box 3 - "bottom" style
    	xdialog -c $dname 3 box 5 115 150 100 bottom
    	xdid -t $dname 3 Box 3: Bottom Left

    	;// Initialising control: Box 4 - "bottom" and "right" styles
    	xdialog -c $dname 4 box 165 115 150 100 bottom right
    	xdid -t $dname 4 Box 4: Bottom Right
    }

    ;// Callback alias for box_styles
    alias box_styles_cb {
    	;// ($2 == mouseenter) checks when the mouse moves over the control for the first time
    	;// and ($3 > 0) checks it is not the dialog ID
    	if (($2 == mouseenter) && ($3 > 0)) {
    		;// $xdid(dialogname, controlID).text returns the text on the control
    		;// Note: the .text property does not apply to all controls.
    		echo Mouse moved over box $3 with text > $xdid($1, $3).text
    	}
    }
Tutorials
Command: | /tb_ex
Teaches: | - How to use the DCX toolbar - Demonstrates that $dialog() commands still work on DCX'd dialogs - How to implement toolbar groups - How to add icons to a toolbar - Usage of control/event specific callback parameters
Script by Duplex
    alias tb_ex {
    	if !$dialog(tb_ex) { dialog -m tb_ex tb_ex }
    }

    dialog tb_ex {
    	title "New Project"
    	size -1 -1 662 136
    	option pixels
    }

    on *:DIALOG:tb_ex:init:*:{
    	;Mark the dialog
    	dcx Mark $dname callback_tb_ex

    	;create the toolbar
    	;Syntax: /xdialog -c [DNAME] [ID] [TYPE] [X] [Y] [W] [H] (OPTIONS)
    	xdialog -c $dname 1 toolbar 0 0 0 25 top list

    	;Set the Icon Size
    	;Syntax: /xdid -l [DNAME] [ID] [SIZE]
    	xdid -l $dname 1 16

    	;Add an Icon to the Toolbars internal Icon list
    	;Syntax: /xdid -w [DNAME] [ID] [+FLAGS] [INDEX] [FILENAME]
    	;Note: this uses the shell.dll provided with dcx and assumes it is in /DCX
    	xdid -w $dname 1 +ndh 10 $mircexe

    	;Add a Button
    	;Syntax: /xdid -a [DNAME] [ID] [N] [+FLAGS] [WIDTH] [#ICON] [COLOR] (Button Text)[TAB](Tooltip Text)
    	xdid -a $dname 1 1 +bkl 100 1 0 ClickMe $tab This is a tooltip

    	;Some more Buttons with Icons
    	;Note how they behave differently because of the flags

    	xdid -w $dname 1 +ndh 5 $mircexe
    	xdid -w $dname 1 +ndh 3 $mircexe
    	xdid -w $dname 1 +ndh 12 $mircexe
    	xdid -w $dname 1 +ndh 8 $mircexe

    	xdid -a $dname 1 2 +dl 80 2 0 Im disabled $tab Cant click this!!!
    	xdid -a $dname 1 3 +kgl 80 3 0 Group 1 $tab I co-operate with "Group 2"
    	xdid -a $dname 1 4 +kgl 120 4 0 Group 2 $tab I co-operate with "Group 1"
    	xdid -a $dname 1 5 +a 120 5 0 Im Autosized to fit the width of text $tab This is a tooltip
    }

    alias callback_tb_ex {
    	if $3 == 1 {
    		if $2 == sclick {
    			echo -a BUTTON NUMBER $4 WAS CLICKED!!! HOORRAY!!!
    		}
    	}
    }
Tutorials
Command: | /tags_eg
Teaches: | - Use of listview with headers - Use of listview $xdid().properties and /xdid commands
Script by sprion
    ; --------< Zion Plugin >------------------------------------------
    ; Name....: Tag
    ; Author..: sprion
    ; Email...: sprion@lyniq.com
    ; Date....: 11 Aug 06
    ; URL.....: http://zion-irc.sourceforge.net
    ; Info....: Ripped from a plugin from the addon Zion Sphinx 3.0
    ;---------------------------------------------------------------------

    ; use /tags_eg to display
    alias tags_eg {
    	dialog -ma tags_eg tags_eg_table
    }

    dialog tags_eg_table {
    	title "Tags"
    	size -1 -1 218 257
    }

    on *:dialog:tags_eg:*:*: {
    	if ($devent == init) {
    		; attaching a callback alias (event handler) to this dialog (important)
    		dcx Mark $dname tags_eg_cb
    		; setting dialog border/look
    		xdialog -b $dname +oty
    		; Call initilisation alias
    		tags_eg_init_dcx
    	}
    }

    alias -l tags_eg_init_dcx {

    	; ---creating a button with ID 3, tabstop parameter, allows tabbing to this control
    	xdialog -c $dname 3 button 145 225 65 25 tabstop
    	xdid -t $dname 3 Close
    	; ---end

    	; ---creating another button with ID 2
    	xdialog -c $dname 2 button 80 225 60 25 tabstop
    	xdid -t $dname 2 De-Tag
    	; ---end

    	;---listview ID 1
    	xdialog -c $dname 1 listview 10 10 200 210 report fullrow showsel nolabelwrap tooltip tabstop grid

    	; adding columns
    	xdid -t $dname 1 +c 0 130 IRC Nick $chr(9) +l 0 70 Tag Type

    	; adding new line, using custom alias
    	xdid -a tags_eg 1 0 0 +c 0 1 0 0 0 0 sprion $chr(9) + 0 Outgoing
    	;---end
    }

    ;// Callback alias for tags_eg
    alias tags_eg_cb {
    	if ($2 = sclick) {
    		if ($3 = 3) {
    			; close
    			xdialog -x $1
    		}
    		elseif ($3 = 2) {
    			; deleting tag
    			xdid -d $1 1 $xdid($1,1,1).selnum
    		}
    	}
    }
Tutorials
Command: | /proxy_eg
Teaches: | - Use of child controls on the DCX Box control - Use of radio boxes to switch between options - Use of global functions to enable/disable controls
Script by sprion
    ; --------< Advanced Real-Life Example >----------------------------------------------------
    ; Name....: Proxy Options
    ; Author..: sprion
    ; Email...: sprion@lyniq.com
    ; Date....: 11 Aug 06
    ; URL.....: http://zion-irc.sf.net
    ; Info....: Ripped from part of the Options dialog from the mIRC addon: Zion Sphinx 3.0
    ;---------------------------------------------------------------------

    ; 63 lines of real codes (minus comments & breaks) to create this dialog.

    ; dialog call, use this to display the dialog
    alias proxy_eg {
    	dialog -ma proxy_eg proxy_eg
    }

    dialog proxy_eg {
    	title Connection Settings
    	size -1 -1 400 210
    }

    on *:dialog:proxy_eg:*:*: {
    	if ($devent = init) {
    		; setting callback alias (event handler, important)
    		dcx Mark $dname proxy_eg_cb
    		; setting dialog borders/look
    		xdialog -b $dname +ty
    		;// Call initilisation alias
    		proxy_eg_init
    	}
    }

    alias -l proxy_eg_init {

    	; setting variables for easy reference
    	; %d = dialog name, %bg2 & %bg2_ are colours
    	var %d $dname

    	; ---normal box creation (proxy box)
    	xdialog -c %d 10 box 10 5 380 160
    	; setting box text
    	xdid -t %d 10 Proxy Server
    	; ---end

    	; ---creating a group of radios (notice the 'group' style, denotes the start of a group)
    	xdid -c %d 10 12 radio 15 20 280 20 group
    	; setting the text for THIS radio
    	xdid -t %d 12 Direct connection to the Internet
    	; repeating for the other radios
    	xdid -c %d 10 13 radio 15 43 280 20
    	xdid -t %d 13 Auto-detect settings from Internet Explorer
    	; next radio
    	xdid -c %d 10 14 radio 15 65 280 20
    	xdid -t %d 14 Manual proxy configuration:
    	; ---end

    	; ---creating label
    	xdid -c %d 10 15 text 40 90 70 20
    	; style & text for label
    	xdid -f %d 15 +ab ansi 8 Tahoma
    	xdid -t %d 15 &HTTP Proxy:
    	; ---end

    	; ---creating an edit box
    	xdid -c %d 10 16 edit 115 87 150 20
    	; ---end

    	; ---another label
    	xdid -c %d 10 17 text 280 90 30 20
    	xdid -f %d 17 +ab ansi 8 Tahoma
    	xdid -t %d 17 &Port:
    	; ---end

    	; ---edit box
    	xdid -c %d 10 18 edit 315 87 50 20
    	; ---end

    	; ---creating button
    	xdid -c %d 10 19 button 120 120 140 25
    	; setting text
    	xdid -t %d 19 Test Connection Settings
    	; ---end

    	; ---more buttons
    	xdialog -c %d 31 button 160 175 70 25
    	xdid -t %d 31 OK
    	; next button
    	xdialog -c %d 32 button 240 175 70 25
    	xdid -t %d 32 Cancel
    	; next button
    	xdialog -c %d 33 button 320 175 70 25
    	xdid -t %d 33 Help
    	; ---end

    	; ---END OF UI CREATING

    	; ---OTHER MISC HERE
    	; i.e. load settings, adjust display to show the settings
    	; in this case i selected 'Direct connection to the Internet', using my custom method
    	_proxytoggle %d 12

    }
    ; [CUSTOM METHOD]
    ; this is a lil extra for you to look at, called when a radio is clicked,
    ; enabling & disabling the edit controls when necessary
    alias -l _proxytoggle {
    	; 14 is the control ID for Manual Proxy
    	; -e = enable, -b = disable
    	var %m $iif($2 = 14,-e,-b)
    	xdid -c $1 $2
    	xdid %m $1 16
    	xdid %m $1 18
    }
    ; Callback alias for dialog, this is the EVENT HANDLER.
    alias proxy_eg_cb {
    	if ($2 = sclick) {
    		; CANCEL
    		if ($3 = 32) xdialog -x $1
    		; OK
    		elseif ($3 = 31) {
    			; save & close dialog
    			; you should add a method to save settings here
    			xdialog -x $1
    		}
    		; any of the radios (ID 12 to 14) clicked, will run this method
    		elseif ($3 isnum 12-14) _proxytoggle $1 $3
    		; HELP
    		elseif ($3 = 33) echo -a HELP CLICKED
    		; test connection
    		elseif ($3 = 19) {
    			echo -a TESTING
    		}
    	}
    	elseif ($2 = close) {
    		; some cleaning up here
    	}
    }

Contact | © 2005-2006 | Last Updated: 14th January, 07