Script problem
Ben Rubinstein
benr_mc at cogapp.com
Wed Oct 24 16:58:58 EDT 2012
On 24/10/2012 21:26, charles61 wrote:
> I tried your script suggestion. It reported card 32 and button 38. When I
> checked this information, there were no checkbox buttons that have custom
> properties on this card.
>
> I went through my project and checked all of the some 700+ checkboxes and
> did not find any checkboxes that had the uMyLabel custom property and no
> custom property label.
Note that LiveCode makes no distinction between an object having a custom
property with an empty string, and an object that doesn't have that custom
property.
If you ask for the uIjustMadeItUp of any object, the value will be the same
empty string as it would be if there was a custom property of that name.
(There is a way of testing whether the custom property actually exists, but
it's convoluted.)
So like Thierry I suspect the problem is that you have five checkboxes - which
might be on one card or five cards - that have no uMyLabel property or a
uMyLabel property with empty value.
Thierry's script suggestion had the problem that it will only show you the
last found one (because each "put" overwrites the previous). So if you want
to find them - ie if you don't think you should have any - then you could make
this variation, to just collect the card and button info for checkboxes that
either don't have the uMyLabel property, or have it empty:
> repeat with y = 1 to the number of cards of stack "MyStack"
> if the mark of card y of stack "MyStack"= true then
> put the number of buttons of card y of stack "MyStack"into nbr
> repeat with n = 1 to nbr
> if the style of button n of card y of stack "MyStack" is "checkbox"\
> and the hilite of button n of card y of stack "MyStack" then
>
if the uMyLabel of button n of card y of stack "MyStack" is
empty then
put y && n & cr after theList
end if
-- temporarily suppress normal data collection
-- put the uMyLabel of button n of card y of stack "MyStack" iinto tName
-- put tName & cr after theList
> end if
> end repeat
> end if
> end repeat
On the other hand if you don't care about that, then just add another test so
that you don't collect the ones where it's empty:
> repeat with y = 1 to the number of cards of stack "MyStack"
> if the mark of card y of stack "MyStack"= true then
> put the number of buttons of card y of stack "MyStack"into nbr
> repeat with n = 1 to nbr
> if the style of button n of card y of stack "MyStack" is "checkbox"\
> and the hilite of button n of card y of stack "MyStack" then
put the uMyLabel of button n of card y of stack "MyStack" into tName
if tName <> empty then
put tName & cr after theList
end if
> end if
> end repeat
> end if
> end repeat
HTH,
Ben
More information about the use-livecode
mailing list