mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#163109 26/10/06 04:39 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
i have 3 edit boxes in dialog and 1 combo.

ID 2,4,6 are edit
ID 8 is combo
ID 9 is OK button.



problem is this code:

Code:
 
on *:dialog:addauth:edit:*:{ 
  if ($did(2,4,6) == $null) || ($did(8).sel == 0) { did -b $dname 9 }
  else { did -e $dname 9 }
}
 


(on init i have did -b $dname 9),
code only ENABLES OK button (ID 9) IF i select valid line
from Combobox (8) first, then from rest edit boxes.

if i start with any editbox first and end with combobox, button OK (9) stays disabled.

anyone care to explain why and how to fix?


IceCapped
#163110 26/10/06 04:43 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
because without selecting something in your combo box the value is 0 (the comparison is if nothing in editbox OR nothing in combo, until something is in combo that will always return.


btk

Last edited by billythekid; 26/10/06 04:44 PM.

billythekid
#163111 26/10/06 04:45 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
but there IS something selected in combo...
read what i wrote.

if i fill in edit boxes, then i select data in combo
but button stays disabled

BUT if i select data in combo first and then fill in edit's
button is enabled


IceCapped
#163112 26/10/06 04:47 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
yeah but the code is in an on edit event


billythekid
#163113 26/10/06 04:51 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
should it be in other?

edit is "change" no?

and i cant use SCLICK for ID 9 (ok)
coz its disabled by default on INIT


IceCapped
#163114 26/10/06 04:53 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
yes edit is change, but it will only perform the code during the changing, i.e when you type something. so typing something and then clicking the combo box will change from an on edit to an on sclick(8).

btk


billythekid
#163115 26/10/06 04:56 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
try

on *:dialog:addauth:edit:*:{
toggleok $dname
}
on *:dialog:addauth:sclick:8:{
toggleok $dname
}
alias toggleok {
if ($did(addauth,2,4,6) == $null) || ($did(addauth,8).sel == 0) { did -b $1 9 }
else { did -e $1 9 }
}


billythekid
#163116 26/10/06 05:06 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
I just checked teh helpfile there and that isn't very well explained, it says an edit triggers when text in combo/edit changes but it should really say when text is entered in editbox or editbox of combo.


billythekid
#163117 26/10/06 05:08 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:
should it be in other?

edit is "change" no?

and i cant use SCLICK for ID 9 (ok)
coz its disabled by default on INIT

sample
Code:
dialog addauth {
  title "add auth"
  size -1 -1 100 100
  option dbu
  edit "" , 2 , 5 5 95 15
  edit "" , 4 , 5 20 95 15
  edit "" , 6 , 5 35 95 15
  combo 8 , 5 50 95 75 , drop
  button "ok", 9 , 40 85 20 10
}
on *:dialog:addauth:init:0:{
  did -a addauth 8 one
  did -a addauth 8 two
  did -c addauth 8 1
}

on *:dialog:addauth:edit:*:{ 
  if ($did(2,4,6) == $null) || ($did(8).sel == 0) { did -b $dname 9 }
  else { did -e $dname 9 }
}


this says (i used your edit event code)
As soon as I edit 2 4 or 6, or if i select the 0 line of 8 Disable 9

did you mean that if you do that you want to Enable 9?

#163118 26/10/06 05:08 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
nice =)
it works, thanks.


IceCapped
#163119 26/10/06 05:11 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
Quote:

this says (i used your edit event code)
As soon as I edit 2 4 or 6, or if i select the 0 line of 8 Disable 9

did you mean that if you do that you want to Enable 9?


on init i already have disabled ID 9 (button)
when user doesnt fill some of edit boxes or combo
(so if any of those controls are empty) it stays disabled.
but if not (if filled) button gets enabled.

thats what i wanted


IceCapped
#163120 26/10/06 05:15 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
you're welcome, like i said, it's not best explained in the help. glad it's working as you wanted.

btk smile


billythekid
#163121 26/10/06 05:25 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Code:
dialog addauth {
  title "add auth"
  size -1 -1 105 100
  option dbu
  edit "" , 2 , 5 5 95 15
  edit "" , 4 , 5 20 95 15
  edit "" , 6 , 5 35 95 15
  combo 8 , 5 50 95 75 , drop
  button "ok", 9 , 40 85 20 10
}
on *:dialog:addauth:init:0:{
  did -a addauth 8 one
  did -a addauth 8 two
  did -c addauth 8 1
  did -b $dname 9
}

on *:dialog:addauth:edit:2,4,6:{ 
  did -e addauth 9
}
on *:dialog:addauth:sclick:8:{ 
  did -e addauth 9
}



#163122 26/10/06 05:42 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
hehe, you cheated and made did -c in init, which i dont need nor want :P

but thanks for effort =)
anyways btk made solution that works so i guess its ok now.

thanks to both (still dont like this behaviour in mirc)


IceCapped
#163123 27/10/06 03:09 AM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
I think this, "if ($did(2,4,6) == $null)", actually only checks $did(2) doesn't it? wink

All 3 edits filled, plus a selection in combo..
Code:
  if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel { did -e addauth 9 }
  else did -b addauth 9

#163124 30/10/06 05:24 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
Quote:
I think this, "if ($did(2,4,6) == $null)", actually only checks $did(2) doesn't it? wink

All 3 edits filled, plus a selection in combo..
Code:
  if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel { did -e addauth 9 }
  else did -b addauth 9


i had some problems with billy's code so i tried yours
...
i added it in edit event yes?
it doesnt work :[

it only works as in my "code"
if i start with combo first and end with edits

otherwise not

Last edited by raZOR; 30/10/06 05:26 AM.

IceCapped
#163125 30/10/06 06:59 AM
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
You have to check the states in edit and sclick events.
Code:
on *:dialog:addauth:edit:2,4,6:check.auth.parms
on *:dialog:addauth:sclick:8:check.auth.parms
alias -l check.auth.parms {
  if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel { did -e addauth 9 }
  else did -b addauth 9
}

#163126 30/10/06 04:12 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
hmm
problem is i have, that i cant use alias :[
it messes up some additional calling of another dialog.

and theres no way for this "checkup" works without alias?


IceCapped
#163127 30/10/06 10:28 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can replace the alias name in both the edit and sclick events with the alias code and it should work fine...
Code:
on *:dialog:addauth:edit:2,4,6:{
  if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel {
    did -e addauth 9
  }
  else did -b addauth 9
}
on *:dialog:addauth:sclick:8:{
  if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel {
    did -e addauth 9
  }
  else did -b addauth 9
}


I don't understand why you can't just use an alias, though. It shouldn't mess anything up as long as it's not the same name as another alias. And if it's a local alias, that shouldn't be a problem unless there is an alias with the same name in the same script file.


Invision Support
#Invision on irc.irchighway.net
#163128 30/10/06 11:03 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
i have problems with IF statements

on combo control if certain line is selected it calls new dialog(alias):

on *:dialog:addauth:sclick:*:{
if ($did = 8) && ($did($did).seltext == SPECIFIC_TEXT) { newauth }
}

but aliases all given affect combo control


;alias toggleok {
;if ($did(addauth,2,4,6) == $null) || ($did(addauth,8).sel == 0) { did -b $1 9 }
;else { did -e $1 9 }
;}

;on *:dialog:addauth:edit:*:{
;if ($did(2,4,6) == $null) || ($did(8).sel == 0) { did -b $dname 9 }
;else { did -e $dname 9 }
;}

so i cant add in these alias
if ($did(addauth,8).seltext == SPECIFIC_TEXT) { newauth }

because it all stops to work.

if, if, else. doesnt work
if, elseif, else. doesnt work

so im screwed :P

Last edited by raZOR; 30/10/06 11:05 PM.

IceCapped
Page 1 of 2 1 2

Link Copied to Clipboard