Page 1 of 1

Newbie: Group struggle

Posted: Sun May 06, 2007 6:54 am
by kpeters
I have a group containing 10 vertically oriented check boxes and I also have a list with <n> strings.

Every string in the list is to be the caption of the corresponding checkbox by position, i.e. the string in position 4 provides the caption for the fourth checkbox from the top. The checkboxes are named CB1 through CB10.

If there are less than 10 entries in the list, I'd like to hide the "extra" checkboxes, i.e. if the list contained only 9 entries then the bottom most checkbox would be hidden.

I have a feeling that this should just take a handful of lines, yet I can only come up with ugly convoluted code...

Would somebody give me hand?

TIA,
Kai

Posted: Sun May 06, 2007 9:45 am
by Mark
Kai,

What you want should be something like the following (untested):

Code: Select all

set the lockloc of grp 1 to true
repeat with x = 1 to 10 -- nr of checkboxes
  hide btn x of grp 1
end repeat
repeat with x = 1 to number of lines of theStrings
  set the tooltip of btn x to line x of theStrings -- or do you mean label?
  set the top of btn x to (the top of grp 1) + (x-1)*24
  show btn x of grp 1
end repeat
Best,

Mark

Posted: Sun May 06, 2007 4:04 pm
by kpeters
Thanks Mark ~

that's 2/3 less code than I had - I really appreciate that.

Kai