twig / dcxdll

Dialog Control eXtensions for mIRC
BSD 3-Clause "New" or "Revised" License
23 stars 2 forks source link

TreeView -c and -a -1 path bug? #30

Closed Dazuzi closed 3 years ago

Dazuzi commented 3 years ago

Previously you could use -1 in the path to select the last item, or to add to the end, but now with 3.1-git394 I'm getting:

D_ERROR /xdid ("treeview 1 -c -1" error: Invalid Path: -1) /xdid -[switch] [dialog] [ID] [options] [switch] = depends on control type [dialog] = the dialog containing the control [ID] = the ID of the control [options] = depends on the control type & switch used

-a works with the first branch/item, but then silently ignores the following commands, and eventually crashes mIRC.

This works fine with an older version:

alias treeview dialog -m treeview treeview
dialog -l treeview {
  size -21 -1 400 420
}
on *:dialog:treeview:init:0: {
  dcx Mark $dname treeview_
  xdialog -c treeview 1 treeview 10 10 200 400 editlabel fullrow hasbuttons haslines linesatroot showsel
  xdialog -c treeview 2 button 220 10 170 40
  xdid -t treeview 2 Add branch
  xdialog -c treeview 3 button 220 60 170 40
  xdid -t treeview 3 Add child
  xdialog -c treeview 4 button 220 110 170 40
  xdid -t treeview 4 Delete
}
alias treeview_ {
  if ($2-3 == sclick 2) {
    xdid -a treeview 1 -1 $chr(9) +e 0 0 0 0 0 0 0 $ticks
    xdid -c treeview 1 -1
  }
  elseif ($2-3 == sclick 3) {
    if ($xdid(treeview,1,selpath)) xdid -a treeview 1 $v1 -1 $chr(9) +e 0 0 0 0 0 0 0 $ticks
    else beep 1
  }
  elseif ($2-3 == sclick 4) {
    if ($xdid(treeview,1,selpath)) xdid -d treeview 1 $v1
    else beep 1
  }
  else ;echo -s TreeView: $1-
}
OokEek commented 3 years ago

This should be fixed now, hopefully the fix hasn't broken something else.