|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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:
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
yeah but the code is in an on edit event
billythekid
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
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
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
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
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?
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
IceCapped
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
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
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
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
billythekid
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
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
}
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
I think this, "if ($did(2,4,6) == $null)", actually only checks $did(2) doesn't it? All 3 edits filled, plus a selection in combo.. if *? *? *? iswm $did(2) $did(4) $did(6) && $did(8).sel { did -e addauth 9 }
else did -b addauth 9
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
I think this, "if ($did(2,4,6) == $null)", actually only checks $did(2) doesn't it? All 3 edits filled, plus a selection in combo.. 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
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
You have to check the states in edit and sclick events. 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
}
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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...
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
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
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
|
|
|
|
|