Changing the selected state of a check box button.

I have a project where I need to have the user start with a large list of check box fields not selected and then be able to select predefined groups of them using a radio button. Long as in 130+ check boxes that the user can then add or remove a couple of additional items before continuing on.

It’s been a few years since I worked extensively in Applescript, and while i LOVE this new interface builder (SO SO much better than ResEdit) I can’t for love or money figure out how to change the state of a check box button within my custom interface from the radio button. What is the Applescipt command to change the state of a button?

Anyone care to take mercy on this desperate soul? :smiley:


try this

set contents of button "myButton" of window "main" to 1 -- or 0

on clicked theObject
set contents of button “ACV” of window “Material Mover” to 1
end clicked

gives and error on build… what am I missing?

in an on clicked handler, you don’t need to set the value,
because you change it while clicking. Just read the value.

I’m using a variable to assign to value to

on clicked theObject
    set ACV to contents of button "ACV" of window "Material Mover" 
end clicked

whats the error? Make sure everything is checked off properly in InterfaceBuilder. Also is it inside a NSBox or Tabview? because then you would have to reference them as well.

It’s inside a NSBox. But must admit I am lost at how to refer to these sub objects… doesn’t help that I was clueless about the need. (Bangs head against wall)

Browser: Firefox
Operating System: Mac OS X (10.4)

It’s quite simple! In interface builder select your box and in the inspector go to “Applescript” There will be a series of check boxes. Don’t worry about them. simply name your box connect it to your script (the radio button at the buttom of the inspector window) save. Go back to your code and try this:

on clicked theObject
set ACV to contents of button "ACV" of box "mybox" of window "Material Mover"
end clicked

This is assuming in interface builder you called your NSBox “mybox” in the inspector window.

Thank you to all. I was able to get the first build done last night and now can get the actual back end written… going to make a lot of people very happy.