Object Naming Conventions

Richard Gaskin ambassador at fourthworld.com
Fri Oct 7 10:41:27 EDT 2011


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




More information about the use-livecode mailing list