DCX - Dialog Control Xtension
 
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 :)
Very Basic
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
	}
}
Still Basic
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
	}
}
Somewhat useful
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 <mirc-directory>/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!!!
		}
	}
}
Practical
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
		}
	}
}
Almost Complete
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
	}
}
xTreebar
Command:/dcxtreebar
Teaches:- Use of xTreebar
Script by Ook
;
; see https://vsthemes.org/en/icon/ for icons
;

alias xtreebar_callback {
  echo -s treebar: $1 :: $2 :: $3-
  !if ($1 == geticons) {
    ; geticons <type> <text>
    ; returns: normal selected expanded
    !if ($2 == status) return 1 2 3
    !if ($2 == channel) return 4 5 6
    !if ($2 == custom) return 7 8 9
    !if ($2 == send) return 10 11 12
    !if ($2 == get) return 13 14 15
    !if ($2 == notify) return 16 17 18
    !if ($2 == query) return 19 20 21
    !if (*folder iswm $2) return 22 23 24
    !return 0 0 0
  }
  !if ($1 == gettooltip) {
    ; gettooltip <type> <text>
    ; returns: tootlip text
    !if ($2 == channel) {
      !if ($3 == #genscripts) return GenScripts Development!
      !if (#mircscript* iswm $3) return mIRC Scripting Channel
    }
    !if ($2 == status) return $3
    !if ($2 == WindowFolder) return Custom Windows Folder
  }
  !elseif ($1 == setitem) {
    ; setitem <type> <htreeitem> <flags>
    ; no return value.
    echo -s setitem: $2 :: $3 :: $4
  }
}
alias dcxtreebar {
  ; clear any old images from internal list.
  xtreebar -w clear
  ; status
  ; status selected
  var %f = $mircdiricons\SysWin.icl
  if ($isfile(%f)) {
    xtreebar -w 0 + 0 %f
    ; channel
    ; channel selected
    xtreebar -w 0 + 1 %f
    ; custom
    ; custom selected
    xtreebar -w 0 + 5 %f
    ; dcc send
    ; dcc send selected
    xtreebar -w 0 + 6 %f
    ; dcc get
    ; dcc get selected
    xtreebar -w 0 + 7 %f
    ; notify
    ; notify selected
    xtreebar -w 0 + 8 %f
    ; query
    ; query selected
    xtreebar -w 0 + 3 %f
    ; folder
    ; folder selected
    xtreebar -w 0 + 15 %f
  }
  ; load all icons in this file
  ;xtreebar -w 0 + -1 $mircexe
  var %f = $mircdiricons\maj32.icl
  if ($isfile(%f)) xtreebar -w 0 + -1 %f
  ; set text colour
  xtreebar -c +t $rgb(255,128,0)
  ; set  line colour
  xtreebar -c +l $rgb(255,0,0)
  ; set message colour
  xtreebar -c +m $rgb(255,0,0)
  ; set event colour
  xtreebar -c +e $rgb(0,0,255)
  ; set xtreebar styles
  xtreebar -s tooltips infotip transparent
  xtreebar -s balloon trackselect nosingleexpand
  ; turn on xtreebar display
  xtreebar -T 1

  ; open custom window just to show treebar doing something.
  window @xtreebar

  ; count how many items are in the treebar
  echo -s cnt: $xtreebar(0).item
  ; show item one
  echo -s item1: $xtreebar(1).item
  ; show item two
  echo -s item2: $xtreebar(2).item
  ; show item three
  echo -s item3: $xtreebar(3).item

}
Menus
Command:/dcxmenus
Teaches:- Use of DCX Menus
Script by Ook
;
; see https://vsthemes.org/en/icon/ for icons
;
alias dcxmenus {
  ; NB: The callback alias is ONLY used for special items that have $chr(14) in the item text, these items can trigger without closing the menu.
  mpopup mirc 1 _dcx_mircmenu_callback
  mpopup mircbar 1 _dcx_mircmenu_callback

  ; normal style menu
  ;_dcx_setmenustyle mirc normal
  _dcx_setmenustyle mirc darknormal
  _dcx_setmenustyle mircbar normal

  ; load icons & images used in menus
  var %f = $mircdirimages\dcx_ppac.png
  if ($isfile(%f)) xpopup -i mirc +a 0 %f
  var %f = $mircdiricons\users.ico
  if ($isfile(%f)) xpopup -i mirc + 0 %f
  var %f = $mircdirimages\one.png
  if ($isfile(%f)) xpopup -i mirc +P 0 %f
  var %f = $mircdirCanada.ico
  if ($isfile(%f)) xpopup -i mircbar + 0 %f
  var %f = $mircdiricons\users.ico
  if ($isfile(%f)) xpopup -i mircbar + 0 %f

  ; set selection box as rounded.
  xpopup -R mirc +r 1
  xpopup -R mircbar +r 1

  ; set menu as alpha blended.
  xpopup -R mirc +a 192
  xpopup -R mircbar +a 192

  ; enable tooltips
  xpopup -R mirc +t 1
  xpopup -R mircbar +t 1

  ;
  ;
}
; changes the menu to a random style.
; $1 = menu
alias _dcx_randommenustyle {
  echo -s menu: $xpopup($1).isopen
  if (!$xpopup($1).ismenu) return
  if (!$xpopup($1).isopen) return
  var %t = normal darknormal vertical verticalrev button buttonrev grade graderev custom custombig officexp office2003 office2003rev icy icyrev
  _dcx_setmenustyle $1 $gettok(%t,$r(1,$numtok(%t,32)),32)
  xpopup -r $1
  .timermenu 1 3 _dcx_randommenustyle $1
}
; $1 = menu name, $2 = style name
alias _dcx_setmenustyle {
  if ($istok(normal darknormal vertical verticalrev button buttonrev grade graderev custom custombig officexp office2003 office2003rev icy icyrev,$2,32)) {
    xpopup -l $1 1-19 default
    if ($2 == normal) {
      ;xpopup -t $1 normal
      ;xpopup -l $1 1 $rgb(240,240,240)
      ;xpopup -l $1 7 $color(83)
      ;xpopup -l $1 8 $color(59)

      set $+(%,dcx_darkmode_,$1) 0
      xpopup -t $1 normal
      xpopup -l $1 1 $rgb(240,240,240)
      xpopup -l $1 3,7 $color(83)
      xpopup -l $1 8,13 $color(59)
      xpopup -l $1 12 $color(60)
    }
    elseif ($2 == darknormal) {
      set $+(%,dcx_darkmode_,$1) 1
      xpopup -t $1 normal

      xpopup -l $1 1,3,13 $rgb(54,54,54) ;color(91)
      xpopup -l $1 4 $rgb(19,19,19) ;color(89)
      xpopup -l $1 6,7,9,19 $rgb(77,77,77) ;color(92)
      xpopup -l $1 8,10,11,12 $rgb(188,188,188) ;color(96)
    }
    elseif ($2 == vertical) xpopup -t $1 vertical
    elseif ($2 == verticalrev) xpopup -t $1 verticalrev
    elseif ($2 == button) {
      xpopup -t $1 button
      xpopup -l $1 7 $rgb(13,180,242)
    }
    elseif ($2 == buttonrev) {
      xpopup -t $1 buttonrev
      xpopup -l $1 7 $rgb(13,180,242)
    }
    elseif ($2 == grade) {
      xpopup -t $1 grade
      xpopup -l $1 1 $rgb(255,192,34)
    }
    elseif ($2 == graderev) xpopup -t $1 graderev
    elseif ($2 == custom) {
      xpopup -t $1 custom
      var %f = $mircdirtop_bg.jpg
      if ($isfile(%f)) xpopup -b $1 %f
    }
    elseif ($2 == custombig) {
      xpopup -t $1 custombig
      var %f = $mircdirtop_bg.jpg
      if ($isfile(%f)) xpopup -b $1 %f
      ; NB: this colour is only seen when alpha draw code is enabled in DrawMenuBitmap() when compiling dll.
      xpopup -l $1 1 $rgb(255,192,34)
    }
    elseif ($2 == officexp) xpopup -t $1 officexp
    elseif ($2 == office2003) xpopup -t $1 office2003
    elseif ($2 == office2003rev) xpopup -t $1 office2003rev
    elseif ($2 == icy) xpopup -t $1 icy
    elseif ($2 == icyrev) xpopup -t $1 icyrev
  }
  elseif ($2 == rounded) xpopup -R $1 +r 1
  elseif ($2 == square) xpopup -R $1 +r 0
  elseif ($2 == roundedmenu) xpopup -R $1 +R 1
  elseif ($2 == squaremenu) xpopup -R $1 +R 0
  elseif ($2 == tooltips) xpopup -R $1 +t 1
  elseif ($2 == notooltips) xpopup -R $1 +t 0
  elseif ($2 == alpha) xpopup -R $1 +a 192
  elseif ($2 == noalpha) xpopup -R $1 +a 255

  if ($1 == mircbar) .timer 1 0 _dcx_setmenustyle scriptpopup $2
}
; $1 = menu name, $2 = style name
alias -l _dcx_ismenustyle {
  ;return $iif($xpopup($1).style == $2,1,0)

  var %s = $($+(%,dcx_menustyle_,$1),2)
  if (!%s) {
    var %s = $xpopup($1).style
    if ((%s == normal) && ($($+(%,dcx_darkmode_,$1),2))) var %s = darknormal
    set -u5 $+(%,dcx_menustyle_,$1) %s
  }
  return $iif(%s == $2,1,0)
}
; $1 = menuname, $2 = id, $3 = cmd
alias _dcx_mircmenu_callback {
  ; changes made to the menu here are done while the menu is still open.
  if ($3 == checksel) {
    if ($2 isnum 600-615) {
      if ($2 == 600) _dcx_setmenustyle mircbar normal
      elseif ($2 == 601) _dcx_setmenustyle mircbar darknormal
      elseif ($2 == 602) _dcx_setmenustyle mircbar vertical
      elseif ($2 == 603) _dcx_setmenustyle mircbar verticalrev
      elseif ($2 == 604) _dcx_setmenustyle mircbar button
      elseif ($2 == 605) _dcx_setmenustyle mircbar buttonrev
      elseif ($2 == 606) _dcx_setmenustyle mircbar grade
      elseif ($2 == 607) _dcx_setmenustyle mircbar graderev
      elseif ($2 == 608) _dcx_setmenustyle mircbar custom
      elseif ($2 == 609) _dcx_setmenustyle mircbar custombig
      elseif ($2 == 610) _dcx_setmenustyle mircbar officexp
      elseif ($2 == 611) _dcx_setmenustyle mircbar office2003
      elseif ($2 == 612) _dcx_setmenustyle mircbar office2003rev
      elseif ($2 == 613) _dcx_setmenustyle mircbar icy
      elseif ($2 == 614) _dcx_setmenustyle mircbar icyrev
      elseif ($2 == 615) _dcx_randommenustyle mircbar

      if ($1 == mircbar) xpopup -r $1
      return check 1 16
    }
    ; 616-619 sets additional effects
    elseif ($2 isnum 616-619) {
      if ($2 == 616) {
        _dcx_setmenustyle mircbar $iif($xpopup(mircbar).isrounded,square,rounded)
        if ($1 == mircbar) xpopup -r $1
        return $iif($xpopup(mircbar).isrounded,check,uncheck)
      }
      elseif ($2 == 617) {
        _dcx_setmenustyle mircbar $iif($xpopup(mircbar).isroundedmenu,squaremenu,roundedmenu)
        if ($1 == mircbar) xpopup -r $1
        return $iif($xpopup(mircbar).isroundedmenu,check,uncheck)
      }
      elseif ($2 == 618) {
        _dcx_setmenustyle mircbar $iif($xpopup(mircbar).istooltips,notooltips,tooltips)
        if ($1 == mircbar) xpopup -r $1
        return $iif($xpopup(mircbar).istooltips,check,uncheck)
      }
      elseif ($2 == 619) {
        ; doesnt work correctly atm. change is only applied when menu reopens.
        _dcx_setmenustyle mircbar $iif($xpopup(mircbar).alpha != 255,noalpha,alpha)
        if ($1 == mircbar) xpopup -r $1
        return $iif($xpopup(mircbar).alpha != 255,uncheck,check)
      }
    }
    elseif ($2 isnum 700-715) {
      if ($2 == 700) _dcx_setmenustyle mirc normal
      elseif ($2 == 701) _dcx_setmenustyle mirc darknormal
      elseif ($2 == 702) _dcx_setmenustyle mirc vertical
      elseif ($2 == 703) _dcx_setmenustyle mirc verticalrev
      elseif ($2 == 704) _dcx_setmenustyle mirc button
      elseif ($2 == 705) _dcx_setmenustyle mirc buttonrev
      elseif ($2 == 706) _dcx_setmenustyle mirc grade
      elseif ($2 == 707) _dcx_setmenustyle mirc graderev
      elseif ($2 == 708) _dcx_setmenustyle mirc custom
      elseif ($2 == 709) _dcx_setmenustyle mirc custombig
      elseif ($2 == 710) _dcx_setmenustyle mirc officexp
      elseif ($2 == 711) _dcx_setmenustyle mirc office2003
      elseif ($2 == 712) _dcx_setmenustyle mirc office2003rev
      elseif ($2 == 713) _dcx_setmenustyle mirc icy
      elseif ($2 == 714) _dcx_setmenustyle mirc icyrev
      elseif ($2 == 715) _dcx_randommenustyle mirc

      if ($1 == mirc) xpopup -r $1
      return check 1 16
    }
    ; 716-719 sets additional effects
    elseif ($2 isnum 716-719) {
      if ($2 == 716) {
        _dcx_setmenustyle mirc $iif($xpopup(mirc).isrounded,square,rounded)
        if ($1 == mirc) xpopup -r $1
        return $iif($xpopup(mirc).isrounded,check,uncheck)
      }
      elseif ($2 == 717) {
        _dcx_setmenustyle mirc $iif($xpopup(mirc).isroundedmenu,squaremenu,roundedmenu)
        if ($1 == mirc) xpopup -r $1
        return $iif($xpopup(mirc).isroundedmenu,check,uncheck)
      }
      elseif ($2 == 718) {
        _dcx_setmenustyle mirc $iif($xpopup(mirc).istooltips,notooltips,tooltips)
        if ($1 == mirc) xpopup -r $1
        return $iif($xpopup(mirc).istooltips,check,uncheck)
      }
      elseif ($2 == 719) {
        ; doesnt work correctly atm. change is only applied when menu reopens.
        _dcx_setmenustyle mirc $iif($xpopup(mirc).alpha != 255,noalpha,alpha)
        if ($1 == mirc) xpopup -r $1
        return $iif($xpopup(mirc).alpha != 255,uncheck,check)
      }
    }
  }
}
menu status,menubar {
  DCX
  .Unload DCX:udcx
  .Settings
  ..Menu Options
  ...Menubar
  ....Menu Styles
  .....$iif($_dcx_ismenustyle(mircbar,normal),$style(1)) $chr(12) Normal $+($chr(14),600) $chr(9) Normal looking menu: _dcx_setmenustyle mircbar normal
  .....$iif($_dcx_ismenustyle(mircbar,darknormal),$style(1)) $chr(12) Dark Normal $+($chr(14),601) $chr(9) Dark Normal looking menu: _dcx_setmenustyle mircbar darknormal
  .....$iif($_dcx_ismenustyle(mircbar,vertical),$style(1)) $chr(12) Vertical $+($chr(14),602) $chr(9) Vertical Gradient: _dcx_setmenustyle mircbar vertical
  .....$iif($_dcx_ismenustyle(mircbar,verticalrev),$style(1)) $chr(12) VerticalRev $+($chr(14),603) $chr(9) Reverse Vertical Gradient: _dcx_setmenustyle mircbar verticalrev
  .....$iif($_dcx_ismenustyle(mircbar,button),$style(1)) $chr(12) Button $+($chr(14),604) $chr(9) Items are buttons: _dcx_setmenustyle mircbar button
  .....$iif($_dcx_ismenustyle(mircbar,buttonrev),$style(1)) $chr(12) ButtonRev $+($chr(14),605) $chr(9) Items are sunken buttons: _dcx_setmenustyle mircbar buttonrev
  .....$iif($_dcx_ismenustyle(mircbar,grade),$style(1)) $chr(12) Gradient $+($chr(14),606) $chr(9) Gradient: _dcx_setmenustyle mircbar grade
  .....$iif($_dcx_ismenustyle(mircbar,graderev),$style(1)) $chr(12) GradientRev $+($chr(14),607) $chr(9) Reverse Gradient: _dcx_setmenustyle mircbar graderev
  .....$iif($_dcx_ismenustyle(mircbar,custom),$style(1)) $chr(12) Custom $+($chr(14),608) $chr(9) Each item is a custom bitmap: _dcx_setmenustyle mircbar custom
  .....$iif($_dcx_ismenustyle(mircbar,custombig),$style(1)) $chr(12) CustomBig $+($chr(14),609) $chr(9) Custom bitmap covers whole menu: _dcx_setmenustyle mircbar custombig
  .....$iif($_dcx_ismenustyle(mircbar,officexp),$style(1)) $chr(12) OfficeXP $+($chr(14),610) $chr(9) OfficeXP style: _dcx_setmenustyle mircbar officexp
  .....$iif($_dcx_ismenustyle(mircbar,office2003),$style(1)) $chr(12) Office2003 $+($chr(14),611) $chr(9) Office2003 style: _dcx_setmenustyle mircbar office2003
  .....$iif($_dcx_ismenustyle(mircbar,office2003rev),$style(1)) $chr(12) Office2003rev $+($chr(14),612) $chr(9) Reverse Office2003 style: _dcx_setmenustyle mircbar office2003rev
  .....$iif($_dcx_ismenustyle(mircbar,icy),$style(1)) $chr(12) Icy $+($chr(14),613) $chr(9) Ice effect: _dcx_setmenustyle mircbar icy
  .....$iif($_dcx_ismenustyle(mircbar,icyrev),$style(1)) $chr(12) IcyRev $+($chr(14),614) $chr(9) Reverse Ice effect: _dcx_setmenustyle mircbar icyrev
  .....Randomize $+($chr(14),615): _dcx_randommenustyle mircbar
  ....$iif($xpopup(mircbar).isrounded,$style(1)) Rounded Selector $+($chr(14),616) $chr(9) Makes menu selection a rounded rect: _dcx_setmenustyle mircbar $iif($xpopup(mircbar).isrounded,square,rounded)
  ....$iif($xpopup(mircbar).isroundedmenu,$style(1)) Rounded Window $+($chr(14),617) $chr(9) Make menus rounded rects: _dcx_setmenustyle mircbar $iif($xpopup(mircbar).isroundedmenu,squaremenu,roundedmenu)
  ....$iif($xpopup(mircbar).istooltips,$style(1)) Tooltips $+($chr(14),618) $chr(9) Enable tooltips like this one!: _dcx_setmenustyle mircbar $iif($xpopup(mircbar).istooltips,notooltips,tooltips)
  ....$iif($xpopup(mircbar).alpha != 255,$style(1)) Alpha Blend $+($chr(14),619) $chr(9) Set the menus to be translucent: _dcx_setmenustyle mircbar $iif($xpopup(mircbar).alpha != 255,noalpha,alpha)
  ...Popups
  ....Menu Styles
  .....$iif($_dcx_ismenustyle(mirc,normal),$style(1)) $chr(12) Normal $+($chr(14),700) $chr(9) Normal looking menu: _dcx_setmenustyle mirc normal
  .....$iif($_dcx_ismenustyle(mirc,darknormal),$style(1)) $chr(12) Dark Normal $+($chr(14),701) $chr(9) Dark Normal looking menu: _dcx_setmenustyle mirc darknormal
  .....$iif($_dcx_ismenustyle(mirc,vertical),$style(1)) $chr(12) Vertical $+($chr(14),702) $chr(9) Vertical Gradient: _dcx_setmenustyle mirc vertical
  .....$iif($_dcx_ismenustyle(mirc,verticalrev),$style(1)) $chr(12) VerticalRev $+($chr(14),703) $chr(9) Reverse Vertical Gradient: _dcx_setmenustyle mirc verticalrev
  .....$iif($_dcx_ismenustyle(mirc,button),$style(1)) $chr(12) Button $+($chr(14),704) $chr(9) Items are buttons: _dcx_setmenustyle mirc button
  .....$iif($_dcx_ismenustyle(mirc,buttonrev),$style(1)) $chr(12) ButtonRev $+($chr(14),705) $chr(9) Items are sunken buttons: _dcx_setmenustyle mirc buttonrev
  .....$iif($_dcx_ismenustyle(mirc,grade),$style(1)) $chr(12) Gradient $+($chr(14),706) $chr(9) Gradient: _dcx_setmenustyle mirc grade
  .....$iif($_dcx_ismenustyle(mirc,graderev),$style(1)) $chr(12) GradientRev $+($chr(14),707) $chr(9) Reverse Gradient: _dcx_setmenustyle mirc graderev
  .....$iif($_dcx_ismenustyle(mirc,custom),$style(1)) $chr(12) Custom $+($chr(14),708) $chr(9) Each item is a custom bitmap: _dcx_setmenustyle mirc custom
  .....$iif($_dcx_ismenustyle(mirc,custombig),$style(1)) $chr(12) CustomBig $+($chr(14),709) $chr(9) Custom bitmap covers whole menu: _dcx_setmenustyle mirc custombig
  .....$iif($_dcx_ismenustyle(mirc,officexp),$style(1)) $chr(12) OfficeXP $+($chr(14),710) $chr(9) OfficeXP style: _dcx_setmenustyle mirc officexp
  .....$iif($_dcx_ismenustyle(mirc,office2003),$style(1)) $chr(12) Office2003 $+($chr(14),711) $chr(9) Office2003 style: _dcx_setmenustyle mirc office2003
  .....$iif($_dcx_ismenustyle(mirc,office2003rev),$style(1)) $chr(12) Office2003rev $+($chr(14),712) $chr(9) Reverse Office2003 style: _dcx_setmenustyle mirc office2003rev
  .....$iif($_dcx_ismenustyle(mirc,icy),$style(1)) $chr(12) Icy $+($chr(14),713) $chr(9) Ice effect: _dcx_setmenustyle mirc icy
  .....$iif($_dcx_ismenustyle(mirc,icyrev),$style(1)) $chr(12) IcyRev $+($chr(14),714) $chr(9) Reverse Ice effect: _dcx_setmenustyle mirc icyrev
  .....Randomize $+($chr(14),715): _dcx_randommenustyle mirc
  ....$iif($xpopup(mirc).isrounded,$style(1)) Rounded Selector $+($chr(14),716) $chr(9) Makes menu selection a rounded rect: _dcx_setmenustyle mirc $iif($xpopup(mirc).isrounded,square,rounded)
  ....$iif($xpopup(mirc).isroundedmenu,$style(1)) Rounded Window $+($chr(14),717) $chr(9) Make menus rounded rects: _dcx_setmenustyle mirc $iif($xpopup(mirc).isroundedmenu,squaremenu,roundedmenu)
  ....$iif($xpopup(mirc).istooltips,$style(1)) Tooltips $+($chr(14),718) $chr(9) Enable tooltips like this one!: _dcx_setmenustyle mirc $iif($xpopup(mirc).istooltips,notooltips,tooltips)
  ....$iif($xpopup(mirc).alpha != 255,$style(1)) Alpha Blend $+($chr(14),719) $chr(9) Set the menus to be translucent: _dcx_setmenustyle mirc $iif($xpopup(mirc).alpha != 255,noalpha,alpha)
  ...$iif($dcx(GetDCXSettings,StaticColours),$style(1)) Static Colours $chr(9) Fix the colours used by DCX (faster): {
    if ($dcx(GetDCXSettings,StaticColours)) dcx SetDCXSettings StaticColours 0
    else dcx SetDCXSettings StaticColours 1
  }
  ...UpdateColours $chr(9) Force DCX to update the colours to match mIRC's: dcx SetDCXSettings UpdateColours
}
xStatusbar
Command:/dcxstatusbar
Teaches:- Use of xStatusbar
Script by Ook
;
; see https://vsthemes.org/en/icon/ for icons
;
alias dcxstatusbar {
  ; make sure the xstatusbar signal is enabled.
  dcx xSignal 1 +s
  ; set statusbar styles
  xstatusbar -A 1 grip tooltips
  ; clear any old images
  xstatusbar -y
  ; set statusbar font.
  xstatusbar -f + default 8 Arial
  ; load some icons/images for later use
  var %f = Canada.ico
  if ($isfile(%f)) xstatusbar -w + 0 %f
  var %f = $scriptdirimages\away.gif
  if ($isfile(%f)) xstatusbar -w +P 0 %f
  var %f = $mircdirimages\dcx_ppac.png
  if ($isfile(%f)) xstatusbar -w +P 0 %f
  var %f = $mircdirimages\371.gif
  if ($isfile(%f)) xstatusbar -w +P 0 %f
  ; setup some cells
  xstatusbar -l 200 200 200 24% 24 24 24 24 24 24 24 24 24 24 24 24
  ; set the cells text
  xstatusbar -t 1 +f 1 -1 -1 4some text $+(.,$chr(226),$chr(152),$chr(186)) 200 wide
  xstatusbar -t 2 +f 2 255 -1 text2 $+($chr(194),$chr(161)) 200 wide $chr(9) a pointless tooltip!
  xstatusbar -t 3 +f 3 255 $rgb(128,128,128) text3 $+($chr(201),$chr(159)) 200 wide $chr(9) another one!
  xstatusbar -t 4 +f 4 -1 $rgb(128,128,128) text4 $+($chr(201),$chr(159)) 24% width $chr(9) and a third!
  var %cell = 5
  while (%cell < 17) {
    xstatusbar -t %cell + 4 -1 -1 24
    inc %cell
  }
}
on *:signal:DCX: {
  ; show any signals we get.
  echo -s dcx signal: $1-
  if ($1 == DCXStatusbar) {
    if ($2 == sclick) {
	  ; when you click on a cell, set it to a random colour.
      xstatusbar -v $4 $rgb($r(0,255),$r(0,255),$r(0,255)) -1 $xstatusbar($4).text
    }
  }
}
setcursors
Command:/setcursors
Teaches:- Use of /dcx SetmIRCCursors
Script by Ook
;
; See https://vsthemes.org/en/cursors/ for cursors.
;
alias setcursors {
  var %path = C:\mIRC\cursors
  if (!$isdir(%path)) return
  ; change the arrow cursor.
  var %f = %path $+ \Crystal Clear v2.1\Normal Select v2.1.ani
  if ($isfile(%f)) dcx SetmIRCCursors arrow %f
  ; change all the size cursors.
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_move.ani
  if ($isfile(%f)) dcx SetmIRCCursors sizeall %f
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_ns.ani
  if ($isfile(%f)) dcx SetmIRCCursors sizens %f
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_ew.ani
  if ($isfile(%f)) dcx SetmIRCCursors sizewe %f
  ; change the help cursor.
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_help.ani
  if ($isfile(%f)) dcx SetmIRCCursors help %f
  ; change the hand cursor.
  var %f = %path $+ \Crystal Clear v2.1\Link Select v2.1.ani
  if ($isfile(%f)) dcx SetmIRCCursors hand %f
  ; change the cross cursor.
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_precision.ani
  if ($isfile(%f)) dcx SetmIRCCursors cross %f
  ; change the up arrow cursor.
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_up.ani
  if ($isfile(%f)) dcx SetmIRCCursors uparrow %f
  ; change the cursors for specific window areas.
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_pen.ani
  if ($isfile(%f)) dcx SetmIRCCursors min,max,close %f
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_ns.ani
  if ($isfile(%f)) dcx SetmIRCCursors bottom,top %f
  var %f = %path $+ \Metro X3 by exsess\Bold\Crimson\X3_ew.ani
  if ($isfile(%f)) dcx SetmIRCCursors left,right %f
  var %f = %path $+ \Crystal Clear v2.1\(Bonus)\Busy (Glow).ani
  if ($isfile(%f)) dcx SetmIRCCursors sysmenu %f
  var %f = %path $+ \Crystal Clear v2.1\Diagonal Resize 1 v2.1.ani
  if ($isfile(%f)) dcx SetmIRCCursors bottomright,topleft %f
  var %f = %path $+ \Crystal Clear v2.1\Diagonal Resize 2 v2.1.ani
  if ($isfile(%f)) dcx SetmIRCCursors bottomleft,topright %f
}
WebBrowser
Command:/dcx_webbrowser
Teaches:- Use of webctrl, tab, divider, treeview, cla
Script by Ook
; set %dcx_browser_home to whatever you want the home url to be.

; menus for IE & WebView2 versions.
menu status,menubar {
  DCX
  .Scripts
  ..WebBrowser IE: dcx_webbrowser IE
  ..WebBrowser WebView2: dcx_webbrowser WebView2
}

; this alias opens the dialog
; $1 = browser type
alias dcx_webbrowser {
  ; if dialog already exists, then show it.
  if ($dialog(dcx_webbrowser)) dialog -v dcx_webbrowser
  else {
    ; default to IE browser type
    if ($0) {
      set %dcx_browser_default_type webctrl
      if ($1 == WebView2) set %dcx_browser_default_type web2ctrl
    }
    set %dcx_browser_type %dcx_browser_default_type
    ; open dialog
    dialog -m dcx_webbrowser dcx_webbrowser
  }
}

; simple dialog as our base.
dialog dcx_webbrowser {
  title "DCX Tabbed WebBrowser"
  icon $mircexe,0
  option pixels
  size -1 -1 500 400

  menu "&File", 60
  item "&Load", 800, 60
  item break, 100
  item "&Save", 801
  item "&Save As...", 802
  item "Capture", 803
  item break, 180
  item "&Cancel", 200, cancel

  menu "Options", 61
  menu "Default Browser", 62, 61
  item "IE $chr(9) Set Internet Explorer as the default.", 311
  item "WebView2 $chr(9) Set WebView2 as the default.", 312
  menu "Menu Options", 68, 61
  menu "Menu Styles", 67, 68
  item "Normal $chr(9) Normal looking menu", 341, 67
  item "Vertical $chr(9) Vertical Gradient", 342, 67
  item "VerticalRev $chr(9) Reverse Vertical Gradient", 343, 67
  item "Button $chr(9) Items are buttons", 344, 67
  item "ButtonRev $chr(9) Items are sunken buttons", 345, 67
  item "Gradient $chr(9) Gradient", 346, 67
  item "GradientRev $chr(9) Reverse Gradient", 347, 67
  item "Custom $chr(9) Each item is a custom bitmap", 348, 67
  item "CustomBig $chr(9) Custom bitmap covers whole menu", 349, 67
  item "OfficeXP $chr(9) OfficeXP style", 350, 67
  item "Office2003 $chr(9) Office2003 style", 351, 67
  item "Office2003rev $chr(9) Reverse Office2003 style", 352, 67
  item "Icy $chr(9) Ice effect", 353, 67
  item "IcyRev $chr(9) Reverse Ice effect", 354, 67

  item "Rounded Selector $chr(9) Makes menu selection a rounded rect", 355, 68
  item "Rounded Window $chr(9) Make menus rounded rects", 356, 68
  item "Square Selector $chr(9) Makes menu selection a rect", 357, 68
  item "Square Window $chr(9) Make menus rects", 358, 68
  item "Tooltips $chr(9) Enable tooltips like this one!", 359, 68
  item "No Tooltips $chr(9) Disable tooltips like this one!", 360, 68
  item "Alpha Blend $chr(9) Set the menus to be translucent", 361, 68
  item "No Alpha Blend $chr(9) disable alpha blending", 362, 68
  item "Hide Menubar $chr(9) Hide windows menubar.", 33, 61
}

; this alias updates the CLA and drawing after the init event.
alias dcx_webbrowser_postinit {
  xdialog -l $1 update
  xdialog -j $1
}

; change the url displayed on the specified tab.
; $1 = dname, $2 = tab id, $3- = url
alias dcx_webbrowser_newurl {
  var %id = $2, %url = $3-, %edit_id = $+(%id,_edit), %web_id = $+(%id,_web)

  xdid -ra $1 %edit_id %url
  xdid -m $1 %web_id +usm +um %url
  ;xdid -m $1 %web_id + + %url
}

; go home
; $1 = dname, $2 = tab id
alias dcx_webbrowser_gohome {
  var %url = $iif(%dcx_browser_home,$v1,about:blank)

  dcx_webbrowser_newurl $1 $2 %url
}

; adjust the position of the add tab button
; $1 = dname
alias dcx_webbrowser_positionaddbutton {
  var %pos = $xdid($1,5).pos, %tabsrect = $xdid($1,4).tabsrect
  xdid -p $1 5 $gettok(%tabsrect,3,32) $gettok(%pos,2-,32)
  xdid -s $1 5
}

; remove the specified tab
; $1 = dname, $2- = tabnum
alias dcx_webbrowser_remtab {
  ; only remove the tab if > 2 tabs exist.
  if ($xdid($1,4).num < 2) return
  xdid -d $1 4 $2
  ; update button position after removal.
  dcx_webbrowser_positionaddbutton $1
}

; add a browser toolbar
; $1 = dname, $2 = tab id
alias dcx_webbrowser_addtoolbar {
  var %id = $2, %rebar_id = $+(%id,_rebar), %edit_id = $+(%id,_edit), %web_id = $+(%id,_web), %back_id = $+(%id,_back), %forward_id = $+(%id,_forward), %refresh_id = $+(%id,_refresh), %home_id = $+(%id,_home), %favicon_id = $+(%id,_favicon)
  var %security_id = $+(%id,_security)

  ; the toolbar as seperate controls
  xdid -c $1 %id %back_id button 0 0 0 0 noformat tooltips disabled tabstop
  xdid -t $1 %back_id Back
  xdid -T $1 %back_id Go backwards...

  xdid -c $1 %id %forward_id button 0 0 0 0 noformat tooltips disabled tabstop
  xdid -t $1 %forward_id Forward
  xdid -T $1 %forward_id Go forwards...

  xdid -c $1 %id %refresh_id button 0 0 0 0 noformat tooltips tabstop
  xdid -t $1 %refresh_id Refresh
  xdid -T $1 %refresh_id Refresh page...

  xdid -c $1 %id %home_id button 0 0 0 0 noformat tooltips tabstop
  xdid -t $1 %home_id Home
  xdid -T $1 %home_id Go home...

  xdid -c $1 %id %favicon_id image 0 0 0 0 transparent hidden

  xdid -c $1 %id %security_id image 0 0 0 0 transparent hidden
  ; This provides a padlock icon.
  var %f = $mircdirIcons\Vista\vista32.icl
  if ($isfile(%f)) xdid -w $1 %security_id + 80 20 %f

  xdid -c $1 %id %edit_id edit 0 0 0 0 autohs tabstop
  xdid -E $1 %edit_id + -es

  xdid -l $1 %id cell 1 $chr(9) +fiwvh %back_id 1 40 20
  xdid -l $1 %id cell 1 $chr(9) +fiwvh %forward_id 1 50 20
  xdid -l $1 %id cell 1 $chr(9) +fiwvh %refresh_id 1 50 20
  xdid -l $1 %id cell 1 $chr(9) +fiwvh %home_id 1 40 20
  xdid -l $1 %id cell 1 $chr(9) +fiwvh %favicon_id 1 20 20
  xdid -l $1 %id cell 1 $chr(9) +fiwvh %security_id 1 20 20
  xdid -l $1 %id cell 1 $chr(9) +fiwv %edit_id 1 0 20

  ; the toolbar as a rebar control
  ;xdid -c $1 %id %rebar_id rebar 0 0 0 0 tooltips tabstop noauto dlbclktoggle fixedorder
  ;;[DNAME] [ID] [N] [+FLAGS] [CX] [CY] [WIDTH] [ICON] [COLOR] (TEXT) [TAB] [CID] [CONTROL] [X] [Y] [W] [H] (OPTIONS) [TAB] (TOOLTIP)
  ;xdid -a $1 %rebar_id 1 +f 40 20 40 0 0 $chr(9) %back_id button 0 0 0 0 noformat tooltips disabled tabstop $chr(9) Go Backwards...
  ;xdid -t $1 %back_id Back
  ;xdid -T $1 %back_id Go Backwards...
  ;xdid -a $1 %rebar_id 1 +f 50 20 50 0 0 $chr(9) %forward_id button 0 0 0 0 noformat tooltips disabled tabstop $chr(9) Go Forwards...
  ;xdid -t $1 %forward_id Forward
  ;xdid -T $1 %forward_id Go forwards...
  ;xdid -a $1 %rebar_id 3 +f 50 20 50 0 0 $chr(9) %refresh_id button 0 0 0 0 noformat tooltips disabled tabstop $chr(9) Refresh Page...
  ;xdid -t $1 %refresh_id Refresh
  ;xdid -T $1 %refresh_id Refresh page...
  ;xdid -a $1 %rebar_id 4 +f 40 20 40 0 0 $chr(9) %home_id button 0 0 0 0 noformat tooltips tabstop $chr(9) Go Home...
  ;xdid -t $1 %home_id Home
  ;xdid -T $1 %home_id Go home...
  ;xdid -a $1 %rebar_id 5 +f 20 20 20 0 0 $chr(9) %favicon_id image 0 0 0 0 transparent $chr(9)
  ;xdid -a $1 %rebar_id 5 +f 20 20 20 0 0 $chr(9) %security_id image 0 0 0 0 transparent $chr(9)
  ;xdid -a $1 %rebar_id 6 +n 80 20 80 0 0 $chr(9) %edit_id edit 0 0 0 0 autohs tabstop $chr(9)
  ;xdid -v $1 %rebar_id 1 2
  ;xdid -l $1 %id cell 1 $chr(9) +fiwv %rebar_id 1 0 20
  ; This provides a padlock icon.
  ;var %f = $mircdirIcons\Vista\vista32.icl
  ;if ($isfile(%f)) xdid -w $1 %security_id + 80 20 %f
}

; add a browser tab
; $1 = dname, $2- = url if any
alias dcx_webbrowser_addtab {
  ; increase the tab coun t to make sure we have a unique id
  inc %dcx_browser_tabcnt

  ; create the named id's for this tab
  var %id = $+(Tab,%dcx_browser_tabcnt), %url = $iif($2 != $null,$2,about:blank)
  var %edit_id = $+(%id,_edit), %web_id = $+(%id,_web), %back_id = $+(%id,_back), %forward_id = $+(%id,_forward), %refresh_id = $+(%id,_refresh), %home_id = $+(%id,_home), %favicon_id = $+(%id,_favicon)

  ; make sure browser type is set.
  if (!$istok(webctrl web2ctrl,%dcx_browser_type,32)) set %dcx_browser_type webctrl

  xdid -a $1 4 0 $iif(%dcx_browser_type == webctrl,2,1) Tab %dcx_browser_tabcnt $chr(9) %id panel 0 0 400 300 notheme $chr(9) %url
  xdid -J $1 %id +r arrow
  xdid -E $1 %id + -cdefhmstCM

  xdid -l $1 %id root $chr(9) +pv 0 1 0 0
  xdid -l $1 %id space root $chr(9) + 0 0 0 0
  xdid -l $1 %id cell root $chr(9) +ph 0 0 0 0

  dcx_webbrowser_addtoolbar $1 %id

  xdid -c $1 %id %web_id %dcx_browser_type 0 0 0 0 tabstop

  if (%dcx_browser_type == webctrl) {
    xdid -e $1 %back_id
    xdid -e $1 %forward_id
  }

  xdid -l $1 %id cell root $chr(9) +li %web_id 10 0 0

  dcx_webbrowser_positionaddbutton $1

  dcx_webbrowser_newurl $1 %id %url
}
; $1 = dname, $2 = menu, $3 = sel id
alias -l _unsetstylechecks {
  did -u $1 341-354
  did -c $1 $calc(340 + $3)
  xpop -s $2 3 2 1 $3 $chr(9) +cCrR 1 14
}
; $1 = type
alias -l _setmenustyle {
  var %m = _dcx_webbrowser, %d = dcx_webbrowser
  if ($istok(normal vertical verticalrev button buttonrev grade graderev custom custombig officexp office2003 office2003rev icy icyrev,$1,32)) {
    set %dcx_browser_menustyle $1
    xpopup -l %m 1 default
    xpopup -l %m 7 default
    xpopup -l %m 8 default
    xdialog -P %d -l 1 default
    xdialog -P %d -l 7 default
    xdialog -P %d -l 8 default
    if ($1 == normal) {
      xpopup -t %m normal
      xpopup -l %m 1 $rgb(240,240,240)
      xpopup -l %m 7 $color(83)
      xpopup -l %m 8 $color(59)
      xdialog -P %d -t normal
      xdialog -P %d -l 1 $rgb(240,240,240)
      xdialog -P %d -l 7 $color(83)
      xdialog -P %d -l 8 $color(59)
      _unsetstylechecks %d %m 1
    }
    elseif ($1 == vertical) {
      xpopup -t %m vertical
      xdialog -P %d -t vertical
      _unsetstylechecks %d %m 2
    }
    elseif ($1 == verticalrev) {
      xpopup -t %m verticalrev
      xdialog -P %d -t verticalrev
      _unsetstylechecks %d %m 3
    }
    elseif ($1 == button) {
      xpopup -t %m button
      xpopup -l %m 7 $rgb(13,180,242)

      xdialog -P %d -t button
      xdialog -P %d -l 7 $rgb(13,180,242)
      _unsetstylechecks %d %m 4
    }
    elseif ($1 == buttonrev) {
      xpopup -t %m buttonrev
      xpopup -l %m 7 $rgb(13,180,242)

      xdialog -P %d -t buttonrev
      xdialog -P %d -l 7 $rgb(13,180,242)
      _unsetstylechecks %d %m 5
    }
    elseif ($1 == grade) {
      xpopup -t %m grade
      xpopup -l %m 1 $rgb(255,192,34)

      xdialog -P %d -t grade
      xdialog -P %d -l 1 $rgb(255,192,34)
      _unsetstylechecks %d %m 6
    }
    elseif ($1 == graderev) {
      xpopup -t %m graderev
      xdialog -P %d -t %m graderev
      _unsetstylechecks %d %m 7
    }
    elseif ($1 == custom) {
      xpopup -t %m custom
      var %f = $mircdirtop_bg.jpg
      if ($isfile(%f)) xpopup -b %m %f

      xdialog -P %d -t custom
      if ($isfile(%f)) xdialog -P %d -b %f
      _unsetstylechecks %d %m 8
    }
    elseif ($1 == custombig) {
      xpopup -t %m custombig
      var %f = $mircdirtop_bg.jpg
      if ($isfile(%f)) xpopup -b %m %f
      ; NB: this colour is only seen when alpha draw code is enabled in DrawMenuBitmap() when compiling dll.
      xpopup -l %m 1 $rgb(255,192,34)

      xdialog -P %d -t custombig
      if ($isfile(%f)) xdialog -P %d -b %f
      ; NB: this colour is only seen when alpha draw code is enabled in DrawMenuBitmap() when compiling dll.
      xdialog -P %d -l 1 $rgb(255,192,34)
      _unsetstylechecks %d %m 9
    }
    elseif ($1 == officexp) {
      xpopup -t %m officexp
      xdialog -P %d -t officexp
      _unsetstylechecks %d %m 10
    }
    elseif ($1 == office2003) {
      xpopup -t %m office2003
      xdialog -P %d -t office2003
      _unsetstylechecks %d %m 11
    }
    elseif ($1 == office2003rev) {
      xpopup -t %m office2003rev
      xdialog -P %d -t office2003rev
      _unsetstylechecks %d %m 12
    }
    elseif ($1 == icy) {
      xpopup -t %m icy
      xdialog -P %d -t icy
      _unsetstylechecks %d %m 13
    }
    elseif ($1 == icyrev) {
      xpopup -t %m icyrev
      xdialog -P %d -t icyrev
      _unsetstylechecks %d %m 14
    }
  }
  elseif ($1 == roundsel) {
    xpopup -R %m +r 1
    xdialog -P %d -R +r 1
    ;did -u %d 357
    ;did -c %d 355
  }
  elseif ($1 == roundwin) {
    xpopup -R %m +R 1
    xdialog -P %d -R +R 1
    ;did -u %d 358
    ;did -c %d 356
  }
  elseif ($1 == squaresel) {
    xpopup -R %m +r 0
    xdialog -P %d -R +r 0
    ;did -u %d 355
    ;did -c %d 357
  }
  elseif ($1 == squarewin) {
    xpopup -R %m +R 0
    xdialog -P %d -R +R 0
    ;did -u %d 356
    ;did -c %d 358
  }
  elseif ($1 == tooltips) {
    xpopup -R %m +t 1
    xdialog -P %d -R +t 1
  }
  elseif ($1 == notooltips) {
    xpopup -R %m +t 0
    xdialog -P %d -R +t 0
  }
  elseif ($1 == alpha) {
    xpopup -R %m +a 192
    xdialog -P %d -R +a 192
  }
  elseif ($1 == noalpha) {
    xpopup -R %m +a 255
    xdialog -P %d -R +a 255
  }
}
; $1 = dialog, $2 = menu
alias -l _setweb2ctrl {
  did -u $1 311
  did -c $1 312
  set %dcx_browser_default_type web2ctrl
  xpop -s $2 3 1 2 $chr(9) +cCr 1 2
}
; $1 = dialog, $2 = menu
alias -l _setwebctrl {
  did -u $1 312
  did -c $1 311
  set %dcx_browser_default_type webctrl
  xpop -s $2 3 1 1 $chr(9) +cCr 1 2
}
; $1 = menuname, $2 = id, $3 = cmd
alias dcx_webbrowser_menuevent {
  var %m = $1, %d = $right($1,-1)
  echo -s menu: $1 :2: $2 :3-: $3- :m: %m :d: %d
  if ($2 == 1) {
    ; add ie tab
    set %dcx_browser_type webctrl
    dcx_webbrowser_addtab %d
  }
  elseif ($2 == 2) {
    ;add webview2 tab
    set %dcx_browser_type web2ctrl
    dcx_webbrowser_addtab %d
  }
  elseif ($2 == 311) _setwebctrl %d %m
  elseif ($2 == 312) _setweb2ctrl %d %m
  elseif ($2 == 32) xdialog -p %d +v 1
  elseif ($2 == 33) xdialog -p %d +v 0
  elseif ($2 == 341) _setmenustyle normal
  elseif ($2 == 342) _setmenustyle vertical
  elseif ($2 == 343) _setmenustyle verticalrev
  elseif ($2 == 344) _setmenustyle button
  elseif ($2 == 345) _setmenustyle buttonrev
  elseif ($2 == 346) _setmenustyle grade
  elseif ($2 == 347) _setmenustyle graderev
  elseif ($2 == 348) _setmenustyle custom
  elseif ($2 == 349) _setmenustyle custombig
  elseif ($2 == 350) _setmenustyle officexp
  elseif ($2 == 351) _setmenustyle office2003
  elseif ($2 == 352) _setmenustyle office2003rev
  elseif ($2 == 353) _setmenustyle icy
  elseif ($2 == 354) _setmenustyle icyrev
  elseif ($2 == 355) _setmenustyle roundsel
  elseif ($2 == 356) _setmenustyle roundwin
  elseif ($2 == 357) _setmenustyle squaresel
  elseif ($2 == 358) _setmenustyle squarewin
  elseif ($2 == 359) _setmenustyle tooltips
  elseif ($2 == 360) _setmenustyle notooltips
  elseif ($2 == 361) _setmenustyle alpha
  elseif ($2 == 362) _setmenustyle noalpha
  elseif ($2 == 800) {
    ; load
    var %tabid = $xdialog(%d,$xdid(%d,4,$xdid(%d,4).sel).childid).namedid
    var %url = $sfile($mircdir,.Select a file,Load)
    if (%url != $null) dcx_webbrowser_newurl %d %tabid %url
  }
  elseif ($2 == 803) {
    ; capture
    var %tabid = $xdialog(%d,$xdid(%d,4,$xdid(%d,4).sel).childid).namedid, %d = $mircdirImages
    if ($isdir(%d)) xdid -C %d $+(%tabid,_web) + $+(%d,\ScreenShot_,$ticks,.png)
    else xdid -C %d $+(%tabid,_web) +
  }
  if (($3 == checksel) && (($2 isnum 311-312) || ($2 isnum 341-362))) return $true
}
on *:DIALOG:dcx_webbrowser:menu:*: dcx_webbrowser_menuevent _dcx_webbrowser $did dialog
;alias dcx_webbrowser_menuCallback {
;  ;echo -s menu: $1 :: $2 :: $3-
;  if ($3 == checksel) {
;    if ($2 isnum 311-312) {
;      if ($2 == 311) _setwebctrl dcx_webbrowser $1
;      elseif ($2 == 312) _setweb2ctrl dcx_webbrowser $1
;      return $true
;    }
;  }
;}
on *:DIALOG:dcx_webbrowser:init:0:{
  set %dcx_browser_tabcnt 0

  set %dcx_webbrowser_icon_ie C:\Program Files (x86)\Internet Explorer\iexplore.exe
  var %d = C:\Program Files (x86)\Microsoft\EdgeWebView\Application\, %f = SmallLogo.png
  if ($findfile(%d,%f,1)) set %dcx_webbrowser_icon_webview $v1
  else set %dcx_webbrowser_icon_webview %dcx_webbrowser_icon_ie
  if (!$istok(normal vertical verticalrev button buttonrev grade graderev custom custombig officexp office2003 office2003rev icy icyrev,%dcx_browser_menustyle,32)) set %dcx_browser_menustyle normal

  dcx Mark $dname dcx_webbrowser_work
  xdialog -b $dname +tyz
  xdialog -g $dname +b $rgb(100,10,17)
  xdialog -T $dname +pb
  xdialog -E $dname + -dfhmtM

  xdialog -P $dname
  xdialog -P $dname -R +r 1
  xdialog -P $dname -R +t 1
  xdialog -P $dname -R +a 192
  xdialog -P $dname -l 11 $rgb(255,0,0)
  var %f = Canada.ico
  if ($isfile(%f)) xdialog -P $dname -i + 0 %f
  xdialog -P $dname -x +D

  if (!$istok(webctrl web2ctrl,%dcx_browser_default_type,32)) set %dcx_browser_default_type webctrl

  did -c $dname $iif(%dcx_browser_default_type == webctrl,311,312)

  var %m = _dcx_webbrowser

  ;xpopup -c %m normal $chr(9) dcx_webbrowser_menuCallback
  xpopup -c %m normal $chr(9) dcx_webbrowser_menuevent
  if ($isfile(%dcx_webbrowser_icon_webview)) xpopup -i %m +P 0 %dcx_webbrowser_icon_webview
  if ($isfile(%dcx_webbrowser_icon_ie)) xpopup -i %m + 1 %dcx_webbrowser_icon_ie
  xpop -a %m -1 $chr(9) + 1 2 Add IE Tab $chr(9) Open new IE tab.
  xpop -a %m -1 $chr(9) + 2 1 Add WebView2 Tab $chr(9) Open new WebView2 tab.
  xpop -a %m -1 $chr(9) +s 30 0 Options
  xpop -a %m 3 -1 $chr(9) +s 31 0 Default Browser
  xpop -a %m 3 1 -1 $chr(9) $iif(%dcx_browser_default_type == webctrl,+Ccr,+Cr) 311 0 IE $chr(9) Set Internet Explorer as the default.
  xpop -a %m 3 1 -1 $chr(9) $iif(%dcx_browser_default_type == web2ctrl,+Ccr,+Cr) 312 0 WebView2 $chr(9) Set WebView2 as the default.
  xpop -a %m 3 -1 $chr(9) +s 34 0 Menu Options
  xpop -a %m 3 2 -1 $chr(9) +s 35 0 Menu Styles
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 341 0 Normal $chr(9) Normal looking menu
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 342 0 Vertical $chr(9) Vertical Gradient
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 343 0 VerticalRev $chr(9) Reverse Vertical Gradient
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 344 0 Button $chr(9) Items are buttons
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 345 0 ButtonRev $chr(9) Items are sunken buttons
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 346 0 Gradient $chr(9) Gradient
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 347 0 GradientRev $chr(9) Reverse Gradient
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 348 0 Custom $chr(9) Each item is a custom bitmap
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 349 0 CustomBig $chr(9) Custom bitmap covers whole menu
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 350 0 OfficeXP $chr(9) OfficeXP style
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 351 0 Office2003 $chr(9) Office2003 style
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 352 0 Office2003rev $chr(9) Reverse Office2003 style
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 353 0 Icy $chr(9) Ice effect
  xpop -a %m 3 2 1 -1 $chr(9) +Cr 354 0 IcyRev $chr(9) Reverse Ice effect
  xpop -a %m 3 2 -1 $chr(9) + 355 0 Rounded Selector $chr(9) Makes menu selection a rounded rect
  xpop -a %m 3 2 -1 $chr(9) + 356 0 Rounded Window $chr(9) Make menus rounded rects
  xpop -a %m 3 2 -1 $chr(9) + 357 0 Square Selector $chr(9) Makes menu selection a rounded rect
  xpop -a %m 3 2 -1 $chr(9) + 358 0 Square Window $chr(9) Make menus rects
  xpop -a %m 3 2 -1 $chr(9) + 359 0 Tooltips $chr(9) Enable tooltips like this one!
  xpop -a %m 3 2 -1 $chr(9) + 360 0 No Tooltips $chr(9) Disable tooltips like this one!
  xpop -a %m 3 2 -1 $chr(9) + 361 0 Alpha Blend $chr(9) Set the menus to be translucent
  xpop -a %m 3 2 -1 $chr(9) + 362 0 No Alpha Blend $chr(9) disable alpha blending

  xpop -a %m 3 -1 $chr(9) + 32 0 Show Menubar $chr(9) Show windows menubar.
  xpop -a %m 3 -1 $chr(9) + 33 0 Hide Menubar $chr(9) Hide windows menubar.

  xpopup -R %m +r 1
  xpopup -R %m +t 1
  xpopup -R %m +a 192

  _setmenustyle %dcx_browser_menustyle

  xdialog -c $dname 1 divider 20 20 460 360 notheme vertical
  xdid -x $dname 1 +
  xdid -W $dname 1 3
  xdid -Q $dname 1 $rgb(20,20,25) $rgb(255,150,0)
  xdid -C $dname 1 +b $rgb(0,255,0)

  xdid -l $dname 1 50 0 $chr(9) 2 treeview 0 0 0 0 notheme showsel tabstop
  xdid -r $dname 1 100 0 $chr(9) 3 panel 0 0 0 0 notheme
  xdid -C $dname 3 +b $rgb(255,25,25)
  xdid -E $dname 1,3 + -ces
  xdid -E $dname 2 + -es

  xdid -c $dname 3 4 tab 0 0 0 0 notheme closable gradient tooltips tabstop shadow hottrack transparent
  xdid -C $dname 4 +bk $rgb(0,233,192)
  xdid -C $dname 4 +t $rgb(0,255,0)
  xdid -E $dname 4 + -s
  if ($isfile(%dcx_webbrowser_icon_webview)) xdid -w $dname 4 +P 0 %dcx_webbrowser_icon_webview
  if ($isfile(%dcx_webbrowser_icon_ie)) xdid -w $dname 4 + 1 %dcx_webbrowser_icon_ie

  xdid -J $dname 3,4 +r arrow

  xdid -c $dname 3 5 button 10 0 30 20 transparent noformat bitmap tooltips
  xdid -t $dname 5 +
  xdid -c $dname 5 +h $rgb(0,255,0)
  xdid -m $dname 5 1
  xdid -T $dname 5 Add a tab...

  xdialog -c $dname 24 statusbar 0 0 0 20 tooltips
  xdid -l $dname 24 40% -1
  var %f = $mircdirCanada.ico
  if ($isfile(%f)) xdid -w $dname 24 + 0 %f
  xdid -t $dname 24 1 +c 0 25 pbar 0 0 100 20 tooltips gradient transparent shadow noformat
  xdid -c $dname 25 16776960
  xdid -v $dname 25 0
  xdid -j $dname 25 a
  xdid -T $dname 25 ProgressBar ToolTip!
  xdid -t $dname 24 2 + 1 ... $chr(9) ...
  xdid -E $dname 24,25 + -es

  xdid -l $dname 3 root $chr(9) +pv 0 1 0 0
  xdid -l $dname 3 space root $chr(9) + 0 0 0 0
  xdid -l $dname 3 cell root $chr(9) +li 4 1 0 0

  xdialog -l $dname root $chr(9) +pv 0 1 0 0
  xdialog -l $dname space root $chr(9) + 5 5 5 22
  xdialog -l $dname cell root $chr(9) +li 1 1 0 0

  var %url = https://www.google.com/
  xdid -a $dname 2 $tab(-1,+ec 1 2 1 1 0 $rgb(0,0,255) 0 %url, %url)
  var %url = https://www.youtube.com/
  xdid -a $dname 2 $tab(-1,+ec 1 2 1 1 0 $rgb(0,0,255) 0 %url, %url)
  var %url = https://www.bing.com/
  xdid -a $dname 2 $tab(-1,+ec 1 2 1 1 0 $rgb(0,0,255) 0 %url, %url)
  var %url = https://aminet.net/
  xdid -a $dname 2 $tab(-1,+ec 1 2 1 1 0 $rgb(0,0,255) 0 %url, %url)

  set %dcx_browser_type %dcx_browser_default_type
  dcx_webbrowser_addtab $dname

  .timer 1 0 dcx_webbrowser_postinit $dname
}
; $1 = dname, $2 = tab id, $3- filename
alias -l _setfavicon {
  if (!$dialog($1)) return
  if (!$isfile($3-)) return
  var %id = $+($2,_favicon)
  xdid -s $1 %id
  xdid -i $1 %id +ghab $3-
}
; $1 = dname
alias -l _resetprogress {
  if (!$dialog($1)) return
  xdid -i $1 25 Waiting...
}
alias dcx_webbrowser_work {
  !if ($2 == error) echo -s DCXError: $1 ID: $3 Type: $4 Prop: $5 Cmd: $6 Error: $7-
  !else echo -s dname: $1 :event: $2 :id: $3 :args: $4-

  if ($2 == sclick) {
    if ($3 == 2) {
      ; treeview control
      if ($4- != $null) echo -s treeview item path: $v1 treeview item text: $xdid($1,$3,$4-).text
    }
    elseif ($3 == 4) .timer 1 1 dcx_webbrowser_positionaddbutton $1
    elseif ($3 == 5) {
      set %dcx_browser_type %dcx_browser_default_type
      dcx_webbrowser_addtab $1
    }
    else {
      var %id = $xdialog($1,$3).namedid
      if (Tab*_back iswm %id) xdid -k $1 $+($gettok(%id,1,95),_web)
      elseif (Tab*_forward iswm %id) xdid -i $1 $+($gettok(%id,1,95),_web)
      elseif (Tab*_refresh iswm %id) xdid -r $1 $+($gettok(%id,1,95),_web)
      elseif (Tab*_home iswm %id) dcx_webbrowser_gohome $1 $gettok(%id,1,95)
    }
  }
  elseif ($2 == dclick) {
    if ($3 == 2) {
      ; treeview control
      if ($4- != $null) {
        ;echo -s treeview item path: $v1 treeview item text: $xdid($1,$3,$4-).text
        var %url = $xdid($1,$3,$4-).text
        if (%url != $null) {
          var %id = $xdialog($1,$xdid($1,4,$xdid($1,4).sel).childid).namedid
          dcx_webbrowser_newurl $1 %id %url
        }
      }
    }
  }
  elseif ($2 == rclick) {
    if (($3 == 2) || ($3 == 4) || ($3 == 5)) {
      xpopup -s _dcx_webbrowser + $xdialog($1).mouse $dialog($1).hwnd

      return $false
    }
  }
  elseif ($2 == closetab) dcx_webbrowser_remtab $1 $4
  elseif ($2 == title) {
    ; title text
    var %id = $gettok($xdialog($1,$3).namedid,1,95), %cnt = 1, %total = $xdid($1,4).num
    while (%cnt < %total) {
      if (%id == $xdialog($1,$xdid($1,4,%cnt).childid).namedid) break
      inc %cnt
    }
    xdid -t $1 4 %cnt $left($4-,40) $+ $iif($len($4-) > 40,...)
    dcx_webbrowser_positionaddbutton $1
  }
  elseif ($2 == endsize) {
    .timer 1 0 dcx_webbrowser_positionaddbutton $1
  }
  elseif ($2 == scroll) {
    if ($3 == 4) .timer 1 0 dcx_webbrowser_positionaddbutton $1
  }
  elseif ($2 == dleave) xdid -t $1 24 2 + 1 - $chr(9) -
  elseif ($2 == status) xdid -t $1 24 2 + 1 $4- $chr(9) $4-
  elseif ($2 == doc_complete) xdid -t $1 24 2 + 1 Done $chr(9) ...
  elseif ($2 == source_changed) {
    ; url
    var %id = $xdialog($1,$3).namedid
    xdid -ra $1 $+($gettok(%id,1,95),_edit) $4-
    xdid -t $1 24 2 + 1 Downloading... $4- $chr(9) $4-
    xdid -h $1 $+($gettok(%id,1,95),_favicon)
    xdid -i $1 $+($gettok(%id,1,95),_favicon) + none
  }
  elseif ($2 == nav_begin) {
    ; url
  }
  elseif ($2 == nav_complete) xdid -t $1 24 2 + 1 Download $iif($4,Complete,Failed) $chr(9) ...
  elseif ($2 == dl_begin) {
    ; size filename
    ; NB: can't use $file($5-).path as this doesnt work when the file doesnt exist.
    var %f = $+($nofile($5-),file.tmp)
    if ($isfile(%f)) return cancel
    .timerresetprogress off
    xdid -v $1 25 0
    if ($0 > 3) {
      xdid -r $1 25 0 $4
      xdid -i $1 25 $nopath(%f) $+(%,d/,$4)
    }
    xdid -t $1 24 2 + 1 Downloading... $chr(9) %f

    return change %f
  }
  elseif ($2 == dl_progress) {
    ; bytes totalbytes filename
    xdid -v $1 25 $4
  }
  elseif ($2 == dl_completed) {
    ; filename
    xdid -v $1 25 0
    xdid -i $1 25 Completed: $4-
    .timerresetprogress 1 5 _resetprogress $1
    xdid -t $1 24 2 + 1 ... $chr(9) ...
  }
  elseif ($2 == dl_canceled) {
    ; reason filename
    xdid -v $1 25 0
    xdid -i $1 25 Canceled: $5-
    .timerresetprogress 1 5 _resetprogress $1
    xdid -t $1 24 2 + 1 ... $chr(9) ...
  }
  elseif ($2 == back) {
    ; cangoback
    var %id = $xdialog($1,$3).namedid
    xdid $iif($4,-e,-b) $1 $+($gettok(%id,1,95),_back)
  }
  elseif ($2 == forward) {
    ; cangoforwards
    var %id = $xdialog($1,$3).namedid
    xdid $iif($4,-e,-b) $1 $+($gettok(%id,1,95),_forward)
  }
  elseif ($2 == history) {
    ; cangoback cangoforwards
    var %id = $xdialog($1,$3).namedid
    xdid $iif($4,-e,-b) $1 $+($gettok(%id,1,95),_back)
    xdid $iif($5,-e,-b) $1 $+($gettok(%id,1,95),_forward)
  }
  elseif ($2 == win_open) {
    ; url
    if (*bing.com* iswm $4-) return cancel
  }
  elseif ($2 == favicon) {
    ; changed url
    ; saved filename
    var %id = $xdialog($1,$3).namedid
    if ($4 == saved) .timer 1 0 _setfavicon $1 $gettok(%id,1,95) $5-
    elseif ($4 == changed) {
      var %d = $mircdirImages
      if ($isdir(%d)) {
        var %f = $+(%d,\favicon_,$md5($5-),.png)
        if (!$isfile(%f)) return save %f
        else .timer 1 0 _setfavicon $1 $gettok(%id,1,95) %f
      }
    }
  }
  elseif ($2 == devtools) {
    var %id = $xdialog($1,$3).namedid
    if ($4 == securityState=secure) xdid -s $1 $+($gettok(%id,1,95),_security)
    else xdid -h $1 $+($gettok(%id,1,95),_security)
  }
  elseif (($2 == keyup) && ($4 == 13)) {
    var %id = $xdialog($1,$3).namedid
    if (Tab*_edit iswm %id) {
      var %url = $xdid($1,%id).text
      if (%url != $null) dcx_webbrowser_newurl $1 $gettok(%id,1,95) %url
    }
  }
  elseif ($2 == close) {
    xpopup -d _dcx_webbrowser
  }

}
ON *:SIGNAL:XPopup-_dcx_webbrowser: {
  ;// nothing clicked
  if ($1 == 0) return

  dcx_webbrowser_menuevent _dcx_webbrowser $1 signal
}
Contact © 2005-2025 Last Updated: 18th February, 25

Valid XHTML 1.0 Transitional Valid CSS!