Working with check boxes.

I’m relatively new to ASObjC, so please forgive me if I’m overlooking the obvious.

My app gives users the option of moving the selected Mail messages to another mailbox after they’ve been processed. The interface window has two checkboxes for this purpose. One (checkbox1) toggles between moving the mail messages and leaving them where they are currently. The other (checkbox2) toggles between using a default mailbox as the destination for moved messages versus using a user-selected mailbox. To implement user selection, two popups follow the two checkboxes. The first allows the user to select the target mail account to which the messages will be moved, and the second allows the user to select the target mailbox to which the messages will be moved in the selected account.

The behaviors I want are as follows:

  • If checkbox1 is not checked, the other three controls are grayed out.
  • If checkbox1 is checked, then if checkbox2 is checked the two popups are set to the default target destination and grayed out.
  • If checkbox1 is checked and checkbox2 is not checked, then the two popups are active, and the user can use them to select a non-default target account and mailbox.

I have two questions regarding this:

  1. Is there any way to detect in real time whenever the user checks or unchecks a checkbox? I want to change the appearance and behavior of the form as the user is making decisions about what to do with the processed messages, so I want to treat the checkboxes like buttons and alter the form immediately in response to the user setting or unsetting the checkboxes.

  2. How does one gray out and protect a control like a popup contingent upon the settings of the checkboxes as described above?

Thanks for your help!!!

You can connect them to action handlers, the same as any other control.

You set its enabled property to false (theCheckbox’s setEnabled:false).