mIRC Homepage
Posted By: KubosKube Trouble pulling value from $dialog() - 05/05/17 02:49 PM
I have this particular dialog...

Code:
dialog example {
  title "Example!!!"
  size -1 -1 62 36
  option dbu
  text "Arbitrary Text!", 1, 2 2 60 8, center
  radio "Continue", 2, 2 10 33 10
  radio "Abort", 3, 35 10 27 10
  button "OK", 4, 2 22 58 12, ok
}


Now here's my problem. I can't get $dialog(example,example) to return any value.
I've tried "//echo -a $dialog()"
And I've tried "set %variable $dialog() | echo -a %variable"
But in both situations, the echo command fails because there is nothing to echo.

What am I doing wrong?
Posted By: maroon Re: Trouble pulling value from $dialog() - 05/05/17 04:10 PM
From within an ON DIALOG event, you can use $dname instead of the name of the dialog, or can get values by using $did($did). But from outside the $devent, you must use $did(Example,number)

Code:
on *:dialog:Example:init:*: {
;Here's where you set values that can't be done when setting up dialog

did -o example 1 1 This overwrites the text label
}


Code:
on *:dialog:Example:sclick:*: {

echo -s Dialog: $dname Event: $devent $iif($did,DID: $did did(did):  $did($did) state: $did($did).state sel: $did($did).sel $did($did).seltext , Clicked on dialog background outside any "Controls" )

if ($did == 4) {
echo -s You clicked on the $did($did) button
}

if ($did == 2-3) { echo -a Clicked on the radio button named $did(Example,$did)
}
Posted By: kap Re: Trouble pulling value from $dialog() - 05/05/17 05:19 PM
Code:
dialog example {
  title "Example!!!"
  size -1 -1 62 36
  option dbu
  text "Arbitrary Text!", 1, 2 2 60 8, center
  radio "Continue", 2, 2 10 33 10
  radio "Abort", 3, 35 10 27 10
  button "OK", 4, 2 22 58 12, ok
  edit "",5, 1 1 1 1, result hide
}
on *:DIALOG:example:init:0:{ did -c $dname 2 | did -o $dname 5 1 Continue }
on *:DIALOG:example:sclick:2:{ did -o $dname 5 1 Continue }
on *:DIALOG:example:sclick:3:{ did -o $dname 5 1 Abort }

alias example { echo -a $dialog(example,example,-4) }
Posted By: KubosKube Re: Trouble pulling value from $dialog() - 05/05/17 08:02 PM
Thank you guys! This makes perfect sense!
© mIRC Discussion Forums