Page 1 of 1

How can I access objects of a group ?

Posted: Thu May 22, 2014 8:54 am
by atout66
Hi to all,
Everything is in the title, but to say more, what should I write if I want to do this:

Code: Select all

put the number of objects of group "myGrp" into lesObj
repeat with xxx = 1 to lesObj
get the hilite of object xxx of group "myGrp"
it IT is TRUE then
blablabla
end if
end repeat
The <blablabla> is a secret instruction I can not provided in this forum :lol:

Thanks in advance for your help, Jean-Paul.

Re: How can I access objects of a group ?

Posted: Thu May 22, 2014 11:44 am
by Klaus
Bonjour Jean-Paul,

"hilite"? So you are trying to check all buttons (radio- or checkbox) in a group?
Then do this:

Code: Select all

...
repeat with i = 1 to the num of btns of grp "myGrp"
  if the hilite of btn i of grp "myGrp" then
     do_my_secret_stuff
  end if
end repeat
...
Hint:
you see my line: if the hilite of btn i of grp "myGrp" then...
And may wonder why i do not write ...= TRUE!?

If you do NOT provide the value you are looking for, then the engine presumes you mean in fact:
if the hilite of btn i of grp "myGrp" = TRUE then

Looks like the engine is an optimist, which saves us some typing :D


Best

Klaus

Re: How can I access objects of a group ?

Posted: Thu May 22, 2014 2:21 pm
by dave.kilroy
Klaus - I hadn't thought of that but you are right - to the engine "the glass is always half-full" :)

Re: How can I access objects of a group ?

Posted: Thu May 22, 2014 2:52 pm
by atout66
OK, thanks for the syntax Klaus:
repeat with i = 1 to the num of btns of grp "myGrp"

Kind regards, Jean-Paul.