How to check if a group contains a specific control ?

Paul Dupuis paul at researchware.com
Fri Aug 23 08:04:43 EDT 2024


On 8/23/2024 7:45 AM, Klaus major-k via use-livecode wrote:
> Hi jbv,
>
>> Am 23.08.2024 um 13:27 schrieb jbv via use-livecode <use-livecode at lists.runrev.com>:
>>
>> Hi list,
>>
>> Is there a quick way to check if a group contains a specific control,
>> something like :
>> if there is a fld "xyz" in grp "abc" of this cd
>> I tried many things but it always generates an error.
>> So far, the only way I can think of is to maintain a custom prop
>> for each group, featuring a string that is the list of all controls
>> names of the group.
> if you don't have any other controls with the same name,
> you could check:
> -> lineoffset("xyz",the childcontrolnames of grp "abc")
>

or, if you prefer:

if "xyz" is among the lines of the childcontrolnames of group "abc" then

NOTE: As mentioned, "xyz" would need to be a unique name for control in 
the group. If you have a field "xyz" and a button "xyz" (or 2 buttons or 
2 or more fields with the same name, etc.) this is not accurate.




More information about the use-livecode mailing list