Object Naming UnConventions
dunbarx at aol.com
dunbarx at aol.com
Fri Oct 7 11:50:45 EDT 2011
I rarely get to act like a pedantic jerk, especially towards a highly respected and iconic personage such as Richard Gaskin.
Not kidding about any of item 2 of line 1.
But ordinal would be 'first control". Cardinal would be "control 1"
That felt better than I thought it would.
I am sure I will regret it, though.
No kidding about item 1 of line 5.
Craig
-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Fri, Oct 7, 2011 6:43 am
Subject: Re: Object Naming Conventions
Pete wrote:
> Thanks Mark, that's what I was looking for.
> Pete
>
> On Thu, Oct 6, 2011 at 6:03 PM, Mark Wieder <mwieder at ahsoftware.net> wrote:
>
>> Phil-
>>
>> Thursday, October 6, 2011, 12:28:38 PM, you wrote:
>>
>> > Here is an excellent starting point:
>> > http://fourthworld.com/embassy/articles/scriptstyle.html
>>
>> > Go to the "Naming Conventions" part.
>>
>> In addition to what's in Richard's writeup I tend to use the following
>> conventions...
Good stuff, Mark.
Oddly enough, for all the tediously curmudgeonry in my naming
conventions article, it doesn't deal much with object names, only
variables, handlers, etc.
In code, object names usually appear after a type specifier, e.g.:
click at the loc of btn "btnSend"
...so it never occurred to me to prefix the object name itself.
This prompted me to try something I'd never used before, addressing a
control using only the "control" specifier followed by the name:
put the rect of control "btnSend"
Sure enough, it works.
I don't know why this surprises me, since I've been using ordinal
reference with "control" for years, e.g.:
repeat with i = 1 to the number of controls
get the rect of control i
...
Somehow I'd gotten the idea that the "control" specifier was limited to
ordinal references, but apparently it's not.
So thanks for your post. It prompted me to learn something new, and if
I get time I may add a section to that article on object names.
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list