dialog mdx.subtest {
  size -1 -1 50 50
  title "Sub dialog test"
  button "Hi",1,0 0 50 20,ok
}
dialog mdx.supertest {
  size -1 -1 100 100
  title "Super dialog test"
  text "",1,0 0 50 50
  button "a",2,1 1 1 1,ok hide
}
on *:DIALOG:dz.submdx*:sclick:1:{
  echo -s hi
  halt
}
alias txt echo $1- | did -i dz.mdx 130 1 text +m $1-
dialog mdx.test {
  size -1 -1 600 400
  title "MDX test dialog"

  ;tab "Test",50,5 5 290 270

  button "Close",1,145 175 50 20,cancel hide

  button "", 50, 300 277 10 105
  list 56 ,310 275 290 110,size
  list 57,5 275 290 110,size extsel
  edit "text +m Rich 4Text! http://www.dim-bulb.net/~dragonzap/dlls/ <-- auto URL highlighting with the autourl style.",130,5 165 590 105,multi return
  button "50 0 100 15 10 1",58,5 115 290 20,tab 50
  edit "Move the scrollbar",59,5 140 290 20,tab 50
  text "50 0 86",60,300 115 200 20
  edit "127.0.0.1",61,300 140 100 20,autohs
  edit "180 0 359",66,510 115 70 20
  list 70,0 0 280 55,size
  list 80,0 440 600 20,size
  button "",90,300 60 300 50
  combo 100,405 140 190 250,size
  button "positioner",110,1 1 1 1
  button "helper",111,1 1 1 1
  button "mouseinput",112,1 1 1 1

  list 120,5 60 250 40,size

  button "",150,0 0 0 0
}
on *:DIALOG:dz.mdx*:menu:*:echo -s did = $did
alias mdxr {
  echo -s MDX removal: $mdx(Remove)
}
alias mdx-dlg {
  dialog -m dz.mdx $+ $1 mdx.test
}
alias subtest {
  dialog -m dz.supermdx mdx.supertest
}
on *:DIALOG:dz.submdx*:init:0:{
  echo -s subVERSION: $mdx(SetMircVersion,$version)
  echo -s subMARK: $mdx(MarkDialog,$dname $dialog($dname).hwnd)
}
on *:DIALOG:dz.supermdx:init:0:{
  echo -s superVERSION: $mdx(SetMircVersion,$version)
  echo -s superMARK: $mdx(MarkDialog,$dname $dialog($dname).hwnd)
  echo -s $mdx(SetControlMDX, [ $dname ] 1 subdialog > [ $ddll ] )
  dialog -m dz.submdx mdx.subtest

  did -a $dname 1 dz.submdx 
}

menu @dz.mdx* {
  mouse:echo mouse move at $mouse.x $mouse.y
  rclick: echo hi
}
on *:DIALOG:dz.mdx*:init:0:{
  ;did -h dz.mdx 56,57,130,58,59,60,61,66,70,80,90,100

  var %clock = $ticks

  linesep -s
  echo -s VERSION: $mdx(SetMircVersion,$version)
  echo -s MARK: $mdx(MarkDialog, $dname $dialog($dname).hwnd)

  echo -s ICON: $mdx(SetDialog,$dname icon 23 c:\windows\progman.exe )
  ;echo -s DLGCOLOR: $mdx(SetDialog, [ $dname ] bgcolor [ $rgb(0,0,0) ] ) 
  ;clientedge dlgmodal

  echo -s STYLE: $mdx(SetDialog, $dname style title border sysmenu )
  echo -s COLOR: $mdx(SetColor,59 text [ $rgb(255,255,0) ] )
  echo -s COLOR: $mdx(SetColor,59 background [ $rgb(0,0,255) ] )
  echo -s COLOR: $mdx(SetColor,59 textbg [ $rgb(0,0,255) ] )

  echo -s COLOR: $mdx(SetColor,70 text [ $rgb(255,255,255) ] )
  ;echo -s FONT SET: $mdx(SetFont,70 15 400 Harlow Solid Italic )

  echo -s RichEdit: $mdx(SetControlMDX,130 richedit nohidesel multi return autourl selbar vsbar > [ $gdll ] )

  did -a $dname 130 limit -1
  ;did -a $dname 130 loadfile +r D:\Program Files\LucasArts\Force Commander Demo\focom.rtf

  echo -s ScrollBar: $mdx(SetControlMDX,58 scrollbar > [ $gdll ] )
  echo -s ProgressBar: $mdx(SetControlMDX,60 progressbar smooth > [ $gdll ] )
  echo -s IPAddress: $mdx(SetControlMDX,61 ipaddress > [ $gdll ] )

  echo -s ToolBar: $mdx(SetControlMDX,70 toolbar arrows nodivider flat wrap noresize > [ $bdll ] )

  echo -s Divider: $mdx(SetControlMDX,50 divider vertical lrborder > $gdll)
  echo -s StatusBar: $mdx(SetControlMDX,80 statusbar sizegrip > [ $bdll ] )
  echo -s Animation: $mdx(SetControlMDX,90 animation transparent > [ $gdll ] )
  echo -s ComboBoxEx: $mdx(SetControlMDX,100 comboboxex dropedit > [ $vdll ] )
  echo -s UpDown: $mdx(SetControlMDX,66 updown arrowkeys alignright right wrap edit numeric > [ $gdll ] )

  echo -s Positioner: $mdx(SetControlMDX,110 positioner size minbox maxbox > [ $ddll ] )
  ;echo -s ContextHelp: $mdx(SetControlMDX,111 contexthelp > [ $ddll ] )

  echo -s MouseInput: $mdx(SetControlMDX,112 mouseinput > [ $ddll ] )
  echo -s TrackBar: $mdx(SetControlMDX,120 trackbar tooltips select ticks > [ $bdll ] )

  echo -s Window: $mdx(SetControlMDX,150 window > $ddll)

  var %winname = @ $+ $dname $+ .test
  window -ph %winname
  did -a $dname 150 %winname

  echo -s WINDOW BORDER: $mdx(SetBorderStyle,150 clientedge)

  echo -s BORDER: $mdx(SetBorderStyle,66 clientedge)
  mdx SetBorderStyle 70,80,120

  did -a $dname 60 barcolor $rgb(255,0,0)
  did -a $dname 60 bgcolor $rgb(0,0,0)
  echo -s TreeView: $mdx(SetControlMDX,56 treeview haslines hasbuttons linesatroot showsel editlabels filedragsource mdxdragsource itemdroptarget insertdroptarget checkboxes > [ $vdll ] )

  did -i $dname 56 1 iconsize normal small
  did -i $dname 56 1 tooltip setdefault TreeView tooltip $+ $crlf $+ text goes here
  did -i $dname 56 1 dragmethod copy move link

  did -i $dname 56 1 seticon normal 3,c:\winnt\system32\shell32.dll
  did -i $dname 56 1 seticon normal 4,c:\winnt\system32\shell32.dll
  did -i $dname 56 1 seticon normal 41,c:\winnt\system32\shell32.dll

  did -a $dname 56 +bce 1 2 0 2 0 Tree view example
  did -i $dname 56 1 cb 2
  did -a $dname 56 +e 1 2 This
  did -i $dname 56 1 cb last
  did -a $dname 56 +e 1 2 is
  did -i $dname 56 1 cb last
  did -a $dname 56 +e 3 3 a
  did -i $dname 56 1 cb root 2
  did -a $dname 56 1 2 tree
  did -i $dname 56 1 cb last
  did -a $dname 56 3 3 view
  did -a $dname 56 3 3 0 3 0 control
  did -i $dname 56 1 branch expandall last

  echo -s ListView: $mdx(SetControlMDX,57 listview showsel infotip headerdrag report checkboxes sortascending mdxdragsource filedragsource droptarget editlabels rowselect > [ $vdll ] )

  echo -s FONT SET: $mdx(SetFont,59 +a -12 700 Comic Sans MS)

  echo -s FONT SET: $mdx(SetFont,57 +a 8 700 Terminal )

  did -i $dname 57 1 dragmethod copy move link

  did -i $dname 57 1 seticon normal 0, $+ $scriptdir $+ users.ico

  did -i $dname 57 1 headerdims 0 0 0 0 0

  did -i $dname 57 1 headertext $tab(0 Nick,+c Online,+c Sound,+c Whois,+r Note)

  ;did -i $dname 57 1 settxt color $rgb(0,0,255)
  ;did -i $dname 57 1 settxt bgcolor none
  ;did -i $dname 57 1 settxt bgcolor $rgb(255,0,0)
  ;did -i $dname 57 1 setbkg url tile c:\windows\@ Ulead MT057.bmp
  ;did -i $dname 57 1 setbkg url tile d:\winxp\FeatherTexture.bmp

  ;echo -s FONT SET: $mdx(SetFont,57 +a 15 700 Kristen ITC )
  var %x = 1
  var %maxno = $notify(0)
  did -i $dname 57 1 tooltip ListView tooltip $+ $cr $+ text goes here
  while ( %x <= %maxno ) {
    did -a $dname 57 $r(0,2) $tab(+ 1 0 3 [ $notify(%x) ] , $iif($notify(%x).ison,yes,no) ,$iif($notify(%x).sound,yes,no),$iif($notify(%x).whois,yes,no)) $+ $tab $+ + 0 0 0 $notify( %x ).note
    inc %x
  }
  did -i $dname 57 1 headerdims auto:all

  echo 4 -s ListView done

  did -i $dname 70 1 bmpsize 32 32

  ; Absolute minimum form
  did -i $dname 70 1 setimage icon large $scriptdir $+ users.ico
  did -i $dname 70 1 setimage icon large 40,C:\WINDOWS\SYSTEM\SHELL32.DLL
  did -i $dname 70 1 setimage +nd icon large 34,c:\windows\progman.exe
  did -i $dname 70 1 setimage +h icon large 22,c:\windows\progman.exe
  ; Absolute maximum form
  did -i $dname 70 1 setimage +nhd 0 icon large 44,C:\WINDOWS\SYSTEM\SHELL32.DLL

  ;did -i $dname 70 1 setbkg tile c:\windows\zambesi.bmp
  did -a $dname 70 +c 1 Users $+ $tab $+ Edit your user settings
  did -a $dname 70 -
  did -a $dname 70 +d 2 CD player $+ $tab $+ Play audio CDs
  did -a $dname 70 -
  did -a $dname 70 +v 3 Mail $tab $+ Send and receive mail
  did -a $dname 70 -
  did -a $dname 70 4 Security $+ $tab $+ Passwords; nick and channel protection

  echo 4 -s Toolbar done

  did -i $dname 80 1 setparts 300 -1
  did -i $dname 80 1 seticon 0 small 13,c:\windows\system\shell32.dll
  did -i $dname 80 2 1
  did -i $dname 80 3 +p 0 MDX Status Bar

  did -a $dname 90 open $scriptdir $+ filecopy.avi
  did -a $dname 90 play

  did -i $dname 100 1 iconsize small
  did -i $dname 100 1 seticon 34,c:\windows\progman.exe
  did -i $dname 100 1 seticon 22,c:\windows\progman.exe
  did -a $dname 100 0 0 0 0 No icon
  did -a $dname 100 1 1 2 1 Has an icon

  did -i $dname 120 1 params 0 100 0
  did -i $dname 120 1 ticfreq 10

  echo 4 -s MDX dialog loaded

  ; Resize all the controls
  resize-controls $dname

  var %clockFinal = $ticks
  echo 12 -s Opening dialog took $calc(%clockFinal - %clock) $+ ms
}
on *:DIALOG:dz.mdx*:sclick:1:{
  .timer -mo 1 1 mdxr
}
on *:DIALOG:dz.mdx*:sclick:56:{
  tokenize 32 $did($dname,$did,1)
  var %action = $1

  if ( $1 == slclick ) {
    var %sel = $mdx-info($dname,$did).select
    var %branch = root $gettok(%sel,2-,32) up
    var %line = $gettok(%sel,-1,32)
    did -i $dname $did 1 cb %branch
    var %branchtext = $did($dname,$did,%line)
    echo -s TreeView item selected - %sel - Text is: %branchtext
  }
  else if ( $1 == dragover ) {
    ; Don't change the drop effect
  }
  else if ( $1 == begindrag ) {
    var %button = $mdx-info($dname,$did).begindrag
    var %item = $mdx-info($dname,$did).event
    echo -s Beginning drag of item %item with %button mouse button
  }
  else if ( $1 == enddrag ) {
    var %item = $mdx-info($dname,$did).event
    echo -s Ending drag of item %item -- method was $mdx-info($dname,$did).enddrag
  }
  else if ( $1 == drop ) {
    var %dropinfo = $mdx-info($dname,$did).dragdrop
    echo -s di: %dropinfo
    var %method = $gettok(%dropinfo,2,32)
    var %type = $gettok(%dropinfo,3,32)
    var %filecount = $gettok(%dropinfo,4,32)
    var %flags = $gettok(%dropinfo,1,32)
    var %fromdlg = from dialog item [[ $+ $gettok(%dropinfo,5-6,32) $+ ]]
    var %button = unknown
    if ( r isincs %flags ) set %button right
    else if ( m isincs %flags ) set %button middle
    else if ( l isincs %flags ) set %button left
    var %droplite = $mdx-info($dname,$did).drophilite
    echo 4 -s Dropped %filecount %type $+ (s) $iif(%type == mdx,%fromdlg) $gettok(%droplite,1,32) treeview branch ( $+ $gettok(%droplite,2-,32) $+ ) with %method method, using %button mouse button:
    var %cfile = 1
    while ( %cfile <= %filecount ) {
      did -i $dname $did 1 getdrop %cfile
      echo 3 -s %type %cfile $+ : $mdx-info($dname,$did).dropinfo
      inc %cfile
    }
  }
  else if ( $1 == droptofile ) {
    echo 6 -s TreeView data dropped to a file
    var %tempfile = C:\TEMP\tempfile.txt
    did -i $dname $did 1 dropfile %tempfile
    write -c " $+ %tempfile $+ " This is a test 
  }
  else if ( $1 == beginlabeledit ) {
    echo Beginning label edit on $mdx-info($dname,$did).event
  }
  else if ( $1 == endlabeledit ) {
    var %branch = $mdx-info($dname,$did).event
    var %subbranch = $gettok(%branch, -1,32)
    var %edittext = $gettok($mdx-info($dname,$did).labeledit,1,9)
    echo Ending label edit on %branch -- text changed to %edittext
    did -i $dname $did 1 cb root %branch up
    var %oldtxt = $did($dname,$did,%subbranch)
    var %newtxt = $gettok(%oldtxt,1-4,32) %edittext
    did -i $dname $did 1 replaceitem %subbranch %newtxt
  }
  else if ( $1 == cancellabeledit ) echo Cancelling label edit on $mdx-info($dname,$did).event
  else if ( $1 == rclick ) echo -s Right click on TreeView (item: $mdx-info($dname,$did).event $+ )
  else if ( $1 == stateclick ) echo -s Clicked state image (checkbox) on TreeView item: $mdx-info($dname,$did).event
  else echo -s Unknown TreeView SCLICK: $did($dname,$did,1)
}
on *:DIALOG:dz.mdx*:dclick:56:{
  var %action = $gettok($did($dname,$did,1),1,32)
  if ( %action == expand ) echo -s TreeView item expanded: $mdx-info($dname,$did).event
  else if ( %action == collapse ) echo -s TreeView item collapsed: $mdx-info($dname,$did).event
}

on *:DIALOG:dz.mdx*:dclick:57:{
  var %seltext = $did($dname,$did,$did($dname,$did).sel)
  echo -s Double-click on $did($dname,$did).sel ( $+ $iif($gettok(%seltext,5,32) == 1,un) $+ checked): $gettok($gettok($gettok(%seltext,2-,32),1,9),2-,32)
}
on *:DIALOG:dz.mdx*:sclick:57:{
  var %action = $gettok($did($dname,$did,1),1,32)

  if (( %action == sclick ) || ( %action == item ) || ( %action == stateclick ) || ( %action == rclick )) {
    var %maxsel = $did($dname,57,0).sel
    var %sellist
    var %cursel = 1
    while ( %cursel <= %maxsel ) {
      set %sellist $addtok(%sellist,$did($dname,57,%cursel).sel,44)
      inc %cursel
    }
    echo -s Selection $+ [[ $+ $gettok($did($dname,$did,1),1,32) $+ ]] ( $+ %maxsel $+ ): %sellist
  }
  else if ( %action == dragover ) {
    ; Don't bother changing the drop effect
  }
  else if ( %action == drop ) {
    var %dropinfo = $mdx-info($dname,$did).dragdrop
    echo -s di: %dropinfo
    var %method = $gettok(%dropinfo,2,32)
    var %type = $gettok(%dropinfo,3,32)
    var %filecount = $gettok(%dropinfo,4,32)
    var %flags = $gettok(%dropinfo,1,32)
    var %fromdlg = from dialog item [[ $+ $gettok(%dropinfo,5-6,32) $+ ]]
    var %button = unknown
    if ( r isincs %flags ) set %button right
    else if ( m isincs %flags ) set %button middle
    else if ( l isincs %flags ) set %button left
    echo 4 -s Dropped %filecount %type $+ (s) $iif(%type == mdx,%fromdlg) on listview item ( $+ $mdx-info($dname,$did).drophilite $+ ) with %method method, using %button mouse button:
    var %cfile = 1
    while ( %cfile <= %filecount ) {
      did -i $dname $did 1 getdrop %cfile
      echo 3 -s %type %cfile $+ : $mdx-info($dname,$did).dropinfo
      inc %cfile
    }
  }
  else if ( %action == droptofile ) {
    echo 6 -s ListView data dropped to a file
    var %tempfile = C:\TEMP\tempfile.txt
    did -i $dname $did 1 dropfile %tempfile
    write -c " $+ %tempfile $+ " This is a test 
  }
  else if ( %action == begindrag ) {
    var %button = $mdx-info($dname,$did).begindrag
    echo -s Beginning drag of selected ListView items with %button mouse button
  }
  else if ( %action == enddrag ) {
    var %item = $mdx-info($dname,$did).event
    echo -s Ending drag of ListView items -- method was $mdx-info($dname,$did).enddrag
  }
  else if ( %action == beginlabeledit ) echo -s Beginning label edit on ListView item $mdx-info($dname,$did).event
  else if ( %action == endlabeledit ) echo -s Ending label edit on ListView item $mdx-info($dname,$did).event - you typed " $+ $mdx-info($dname,$did).labeledit $+ "
  else if ( %action == cancellabeledit ) echo -s Cancelling label edit on ListView item $mdx-info($dname,$did).event
  else if ( %action == headerclick ) echo -s Clicked ListView header $mdx-info($dname,$did).headerevent
  else echo -s Unknown ListView SCLICK: $did($dname,$did,1)
}
on *:DIALOG:dz.mdx*:sclick:58:{
  did -o $dname 59 1 $iif($tokdid($dname,$did,7) == stopped,Stopped at, Moving to) $+ : $tokdid( $dname ,$did,1) | haltdef
  did -o $dname 60 1 $tokdid($dname,$did,1)
}
on *:DIALOG:dz.mdx*:edit:61:echo -s IP address: $did($did)
on *:DIALOG:dz.mdx*:sclick:70:echo -s Toolbar click: $did($did).sel
on *:DIALOG:dz.mdx*:dclick:70:echo -s Toolbar dropdown click: $did($did).sel
on *:DIALOG:dz.mdx*:sclick:80:echo -s Status bar click: $did($did).sel
on *:DIALOG:dz.mdx*:dclick:80:echo -s Status bar double-click: $did($did).sel
on *:DIALOG:dz.mdx*:sclick:90:{
  var %action = $tokdid($dname,$did,3)
  if ( %action == stop ) echo -s Animation ended
  else if ( %action == lsclick ) {
    did -a $dname 90 play
    echo -s Animation left click at $tokdid($dname,$did,1-2)
  }
  else if ( %action == rsclick ) {
    did -a $dname 90 stop
    echo -s Animation right click at $tokdid($dname,$did,1-2)
  }
  else if ( %action == ldclick ) echo -s Animation left double-click at $tokdid($dname,$did,1-2)
}
on *:DIALOG:dz.mdx*:edit:100:echo -s Combobox edit: $did($did)
on *:DIALOG:dz.mdx*:sclick:100:echo -s Combobox select ( $+ $did($did).sel $+ ): $did($did,$did($did).sel)
on *:DIALOG:dz.mdx*:dclick:100:echo -s Combobox double-click ( $+ $did($did).sel $+ ): $did($did,$did($did).sel)
on *:DIALOG:dz.mdx*:edit:66:echo -s Updown change: $did($did)

alias -l resize-views {
  var %w = $dialog($1).cw,%h = $dialog($1).ch
  var %divl = $gettok($did($1, 50), 3, 32),%divr = $gettok($did($1, 50), 4, 32)
  var %viewh = $calc(%h - 295)

  ; The ListView
  mdx MoveControl $1 57 * * $calc(%divl - 2) %viewh

  ; The TreeView
  mdx MoveControl $1 56 $calc(%divr - 3) * $calc(%w - %divr - 2) %viewh
}
alias -l resize-controls {
  var %w = $dialog($1).cw,%h = $dialog($1).ch

  ;echo -s Dialog resized to %w x %h
  mdx MoveControl $1 59 * * $calc(%w -310)
  mdx MoveControl $1 61 $calc(%w -300)
  mdx MoveControl $1 100 $calc(%w -195)

  ; The Divider
  var %divx = *

  if ( $2 == event ) {
    ; If in an event, moves to some percentage of where it used to be
    var %divpos = $mdx(MoveControl,$1 50)
    var %divpercent = $calc((( $gettok(%divpos,1,32) + $gettok(%divpos,3,32) ) / 2) / %w)
  }
  mdx MoveControl $1 50 %divx * * $calc(%h -300)

  resize-views $1

  ; The RichEdit
  mdx MoveControl $1 130 * * $calc(%w -10)

  mdx MoveControl $1 58 * * $calc(%w /2 -10)
  mdx MoveControl $1 60 $calc(%w /2) * $calc(%w /2 -100)
  mdx MoveControl $1 66 $calc(%w -90)
  mdx MoveControl $1 80 * $calc(%h -20) %w
  mdx MoveControl $1 70 * * %w
  did -i $1 80 1 setparts $calc(%w - 300) -1
}
on *:DIALOG:dz.mdx*:sclick:50:{
  ; Divider event
  tokenize 32 $did($dname, $did)

  var %dw = $dialog($dname).cw
  var %rm = $calc(%dw - 100)

  if ($1 == move) resize-views $dname
  else if ($1 == moving) {
    ; Restrict position
    if ($6 > %rm) did -a $dname $did restrict right %rm

    ; Re-tokenize
    tokenize 32 $did($dname, $did)
    if ($5 < 100) did -a $dname $did restrict left 100
  }
}
on *:DIALOG:dz.mdx*:sclick:110:{
  var %action = $gettok($did($did),1,32)
  if ( %action == size ) resize-controls $dname event
  else if ( %action == move ) echo -s Dialog moved to $dialog($dname).x $+ , $+ $dialog($dname).y
  else if (( %action == sizing ) || ( %action == moving )) {
    ;Force the dialog to use sizes in 40-pixel increments
    var %quantize = 20
    var %min.w = 120
    var %min.h = 120

    tokenize 32 $mdx-info($dname, $did).dragRect

    ;Client coordinates
    var %cw = $7, %ch = $8

    ; For our demo purposes, client width/height should not be smaller than 120
    if ( %cw < %min.w ) {
      set %cw %min.w
    }
    if ( %ch < %min.h ) {
      set %ch %min.h
    }

    set %cw $calc($int($calc(%cw / %quantize)) * %quantize)
    set %ch $calc($int($calc(%ch / %quantize)) * %quantize)

    did -a $dname $did setSize c %cw %ch
  }
  else if ( %action == enterSizeMove ) {
    echo -s Began moving/resizing of dialog from position $mdx-info($dname, $did).orgRect
  }
  else if ( %action == exitSizeMove ) {
    echo -s Finished moving/resizing of dialog from previous position of $mdx-info($dname, $did).orgRect
  }
  else echo -s Dialog was %action $+ d -- state is now $mdx-info($dname, $did).state
}
on *:DIALOG:dz.mdx*:sclick:111:echo -s Context help - $did($did)
on *:DIALOG:dz.mdx*:sclick:112:{
  tokenize 32 $did($did)
  echo -s Mouse input - $1 at dialog coords $mdx(ConvertCoords, * [ $dname ] * [ $mouse.dx ] [ $mouse.dy ] )
  if ($1 == lbuttondown) did -a $dname 110 setmode move +m
  else if ($1 == rbuttondown) did -a $dname $did capture
  else if ($1 == rbuttonup) did -a $dname $did release
}
on *:DIALOG:dz.mdx*:sclick:120:{
  tokenize 32 $did($did,1)
  if ( $9 == tipText ) {
    ; Set the tooltip text
    did -i $dname $did 1 tipText $1 $+ %
    return
  }
  if ( $6 == * ) echo -s Trackbar position: $1 (No selection)
  else echo -s Trackbar position: $1 (Selection: $6 to $7 $+ )
}

alias mdx {
  if ( $2- == $null ) return $dll($udll,$1,.)
  return $dll($udll,$1,$2-)
}
alias mdx-info {
  var %dname, %did
if ($0 = 1) {
set %dname $dname
set %did $1
}
else {
set %dname $1
set %did $2
}
  did -i %dname %did 1 page $prop
  return $gettok($did(%dname, %did, 1), 3-, 32)
}

#mdx-debug off
alias -l udll return e:\mirc\mdx\debug\mdx.dll
alias -l gdll return e:\mirc\mdx\ctl_gen\debug\ctl_gen.mdx
alias -l vdll return e:\mirc\mdx\views\debug\views.mdx
alias -l bdll return e:\mirc\mdx\bars\debug\bars.mdx
alias -l ddll return e:\mirc\mdx\dialog\debug\dialog.mdx
#mdx-debug end

alias -l udll return $scriptdir $+ mdx.dll
alias -l gdll return $scriptdir $+ ctl_gen.mdx
alias -l vdll return $scriptdir $+ views.mdx
alias -l bdll return $scriptdir $+ bars.mdx
alias -l ddll return $scriptdir $+ dialog.mdx

alias mdx.dll return $udll


;alias -l udll return e:\mirc\mdx\release\mdx.dll
;alias -l gdll return e:\mirc\mdx\ctl_gen\release\ctl_gen.mdx
;alias -l vdll return e:\mirc\mdx\views\release\views.mdx
;alias -l bdll return e:\mirc\mdx\bars\release\bars.mdx
;alias -l ddll return e:\mirc\mdx\dialog\release\dialog.mdx
alias -l tab {
  if ( $1- == $null ) return $chr(9)
  var %tablist
  var %wpm = 1
  while ( $ [ $+ [ %wpm ] ] != $null ) {
    set %tablist $instok(%tablist, $ [ $+ [ %wpm ] ] ,0,9)
    inc %wpm
  }
  return %tablist
}
alias -l tokdid {
  if ( $isid == $true ) return $gettok($did($1,$2),$3,32)
  did -o $1-2 1 $puttok($did($1,$2),$4-,$3,32)
}
alias -l sbtext {
  if ( $dialog($1) == $null ) {
    .timer.SBT. $+ $1 off
    return
  }
  did -i $1 80 2 1 $replace($2-,$tab,{tab})
  .timer.SBT. $+ $1 1 2 clearsb $1
}
alias -l clearsb {
  if ( $dialog($1) == $null ) return
  did -i $1 80 2 1
}

on *:DIALOG:dz.mdx*:*:123:echo -s Dynamic item event: $devent
