Jump to content

Checkbox Trouble


CharmedOne

Recommended Posts

I always had problems with check boxes compared to buttons & getting them to enable & stay checked if enabled can someone help fix.

 

on *:dialog:SpamKick:init:*: {
  if (%linkclear) == on) { did -c $dname 8 }
}

 

on *:dialog:SpamKick:sclick:8:{
  if ($did(8).state == 0) { set %linkclear Off }
  elseif ($did(8).state == 1) { set %linkclear On }
}

Link to comment
Share on other sites

I always had problems with check boxes compared to buttons & getting them to enable & stay checked if enabled can someone help fix.

 

on *:dialog:SpamKick:init:*: {
    if (%linkclear) == on) { did -c $dname 8 }
  }

 

on *:dialog:SpamKick:sclick:8:{
    if ($did(8).state == 0) { set %linkclear Off }
    elseif ($did(8).state == 1) { set %linkclear On }
  }

 

You really do not need to declare both states

on *:dialog:SpamKick:init:*: {
    if (%linkclear) == On) { did -c $dname 8 }
  }
on *:dialog:SpamKick:sclick:8:{
    if ($did(8).state == 1) { set %linkclear On }
    else { set %linkclear Off }
  }

 

unless you have some reason for setting an off variable i would just unset the variable to keep from cluttering up the variables area

on *:dialog:SpamKick:init:*: { $iif(%linkclear,did -c $dname 8)   }
on *:dialog:SpamKick:sclick:8:{  $iif($did(8).state == 1,set %linkclear On,unset %linkclear)   }

Link to comment
Share on other sites

i just made this and it works fine

 

dialog SpamKick {
   title "New Project"
   size -1 -1 53 37
   option dbu
   check "test", 8, 8 17 50 10
}
on *:dialog:SpamKick:init:*: { $iif(%linkclear,did -c $dname 8)   }
on *:dialog:SpamKick:sclick:8: {  $iif($did(8).state == 1,set %linkclear On,unset %linkclear)   }

Link to comment
Share on other sites

Thanks errOr this didnt work

 

on *:dialog:SpamKick:sclick:8: {  $iif($did(8).state == 1,set %linkclear On,unset %linkclear)   }

 

So i changed your code to this & it worked thanks for the help errOr

 

  if ($did == 8) { $iif($did(8).state == 1,set %linkclear On,unset %linkclear)   }
}

Link to comment
Share on other sites

well if you left it as a sclick the did would always be 8 so if you are still using sclick:8 is seems a bit pointless.. what i posted works.. i tested it.. but as always there are different ways of doing the same thing.. whatever works for u

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...