twig / dcxdll

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

$xdid().childid returns an error instead of $null #79

Open Dazuzi opened 8 months ago

Dazuzi commented 8 months ago

Not completely sure if this is intended, but at least previously it just returned a $null.

alias test dialog -m test test
dialog -l test {
  size -1 -1 400 400
}
on *:dialog:test:init:0: {
  dcx Mark $dname test_
  xdialog -c test 1 tab 10 10 380 380 tabstop
  xdid -a test 1 0 0 Test $chr(9) 2 panel 0 0 0 0
  echo -a This one works:  $xdid(test,1,1).childid
  echo -a This one returns an error instead of $!null: $xdid(test,1,2).childid
}
alias test_ ;echo -s test: $1-

Results in:

This one works: 2 D_ERROR $xdid ("test 1 childid 2" error: Invalid Item) $xdid([dialog],ID).prop [dialog] = the dialog containing the control [ID] = the ID of the control to affect (options) = depends on the prop used [prop] = depends on the control type

image

EDIT: version 3.1-git978.

OokEek commented 8 months ago

The error here isn't telling you that the child doesn't exist, its telling you that the tab doesn't exist.

Dazuzi commented 8 months ago

Yes, the problem is that it previously didn't return an error, so you could easily loop through the tabs. I.e.:

set -l %x 1
while ($xdid(test,1,%x).childid) {
  echo -a TAB: %x ID: $v1
  inc %x
}

It appears this is not a recent change, I'm just late to the party. Workaround would be to use .num, but it as just so convenient before.