short name broken?
Richard Gaskin
ambassador at fourthworld.com
Tue Nov 1 14:12:42 EDT 2016
dunbarx wrote:
> Richard wroteL
>> In v9 try:
>>
>> 1. Create a new field
>. 2. In the Message Box, run:
>>
>> put the short name of last field
>>
>> I get the name instead, e.g. "field id 1009".
>>
>> IIRC the short name of a field is empty until you set it. When a
>> field is unnamed, "the short name" returns empty and "the name"
>> would return the form shown above, yes?
>>
>> Otherwise, we have no way to know when a field has not yet been
>> named.
>
> If I make a new control, and immediately ask for its name, or short
> name, I have always gotten the default name in the inspector, which
> is something like:
>
> field "field"
> or
> button "button".
Exactly. The form has changed.
This is at least progress, since the older IDE habit of forcing
redudant-form names was always confusing and needed to go, leading us to
less-than-graceful coding like:
put field "field 1" into field 1
This was made super-awkward since ordinal references are a very specific
thing in xTalks, and the force-applied name used an ordinal form that
will bear no relationship to its actual ordinal reference the moment its
layer changes.
So good riddance on that - kudos to the team for finally taking care of
that.
But here we get to a condundrum:
> Never empty.
You're absolutely right. When in doubt I check the
Winkler-Kamins-DeVoto reference, and indeed they verify that all name
queries will return a value, even when the property itself is empty.
When using "the short name" on an unnamed object, WKD says it should
return the ID form, as LC currently does.
I can appreciate the hand-holding of ensuring that name queries always
return a meaningful value, it does raise a question: is it possible to
know if the name property of an object is empty?
For example, if I wrote a script similar to the older IDE script that
insisted on setting the name property to a value that resembles what we
get with unnamed objects, how could we know the object's name us truly
empty?
In a pre-coffee moment I had mistakenly believe that the short name
might allow this, but I'm not disappointed to find that LC now follows
the tradition of the mother tongue.
I suppose if I ever find myself needing to know that I could do this:
function HasNoName pObj
put the properties of pObj into tA
return (tA["name"] is empty)
end HasNoName
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list