mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 50
D
Babel fish
OP Offline
Babel fish
D
Joined: Aug 2003
Posts: 50
I need to unset some variables (setted using some EDIT text boxes) but only if the user closes the dialog window without pressing "ok", using the upper right corner close button ---> [x]

I tryed this:

on 1:dialog:window:close:*:{ /unset %var1 %var2 %var3 }

But it seems to activate the command with "ok" button too

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
One way around it is to remove the "ok" property of the OK button. Instead make an sclick definition for that button that performs whatever commands you want and then calls /dialog -x $dname


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2003
Posts: 50
D
Babel fish
OP Offline
Babel fish
D
Joined: Aug 2003
Posts: 50
Is there another way?

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Untested, but as a suggestion, check the value of $did in your close event. If the value is 0 or $null, then the x will have been pressed, otherwise $did should (to the best of my knowledge) return the id of the button pressed.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
Is there another way?


yes assign commands to a hidden cancel button

[sample
Code:
alias test dialog -m test-x test-x
dialog test-x {
  title "Test the -X"
  size -1 -1 100 100
  option dbu
  list 100, 2 15 96 70
  box "Listed %Vars to Unset" , 200, 1 5 98 98
  button "OK", 900, 35 80 30 15, ok
  [color:red]button "", 999, 0 0 0 0, cancel[/color]
}
on *:dialog:test-x:init:0:{
  set %var-1 this 
  set %var-2 is a 
  set %var-3 sample
  did -a test-x 100 $+(%,var-1) %var-1
  did -a test-x 100 $+(%,var-2) %var-2
  did -a test-x 100 $+(%,var-3) %var-3
}
on *:dialog:test-x:sclick:900:{
  echo -s $($did(test-x,100).seltext,2)
  unset %var-*
}
[color:red]
on *:dialog:test-x:sclick:999:{
  unset %var-*
}
[/color]

Joined: Aug 2003
Posts: 50
D
Babel fish
OP Offline
Babel fish
D
Joined: Aug 2003
Posts: 50
It doesn't seem true (if I'm not wrong). I tryed to add this:

on 1:dialog:window:close:*:{ /echo -a $did }

But it displays 0 even if I press OK or Enter on the keyboard

Joined: Aug 2003
Posts: 50
D
Babel fish
OP Offline
Babel fish
D
Joined: Aug 2003
Posts: 50
Quote:
Quote:
Is there another way?


yes assign commands to a hidden cancel button


It seems a good solutions. I used it but I gave dimension and position values to the button adding the "hide" option, so it will be easier if I have to modify it with Dialog Studio wink

Code:
button "", 999, 180 190 20 20, hide cancel


Link Copied to Clipboard