Re: Object naming

2020-07-29 Thread Martin Koob via use-livecode
Stop dave.
https://www.youtube.com/watch?v=ibfQX11aPmg


> On Jul 28, 2020, at 4:57 PM, Jerry Jensen via use-livecode 
>  wrote:
> 
> Dave’s not here.
> https://www.youtube.com/watch?v=rtDAK7Umk7A
> 
>> On Jul 27, 2020, at 10:24 PM, Richard Gaskin via use-livecode 
>>  wrote:
>> 
>> Consider a simplified problem statement:
>> 
>> You have two objects of the same type in a container, and you want to tell 
>> them apart but had given them the same name.
>> 
>> 
>> 
>>  Too Many Daves
>>  by Dr. Seuss
>> 
>>  Did I ever tell you that Mrs. McCave
>>  Had twenty-three sons and she named them all Dave?
>>  Well, she did. And that wasn't a smart thing to do.
>>  You see, when she wants one and calls out, "Yoo-Hoo!
>>  Come into the house, Dave!" she doesn't get one.
>>  All twenty-three Daves of hers come on the run!
>>  This makes things quite difficult at the McCaves'
>>  As you can imagine, with so many Daves.
>>  And often she wishes that, when they were born,
>>  She had named one of them Bodkin Van Horn
>>  And one of them Hoos-Foos. And one of them Snimm.
>>  And one of them Hot-Shot. And one Sunny Jim.
>>  And one of them Shadrack. And one of them Blinkey.
>>  And one of them Stuffy. And one of them Stinkey.
>>  Another one Putt-Putt. Another one Moon Face.
>>  Another one Marvin O'Gravel Balloon Face.
>>  And one of them Ziggy. And one Soggy Muff.
>>  One Buffalo Bill. And one Biffalo Buff.
>>  And one of them Sneepy. And one Weepy Weed.
>>  And one Paris Garters. And one Harris Tweed.
>>  And one of them Sir Michael Carmichael Zutt
>>  And one of them Oliver Boliver Butt
>>  And one of them Zanzibar Buck-Buck McFate ...
>>  But she didn't do it. And now it's too late.
>> 
>> --
>> Richard Gaskin
>> Fourth World Systems
>> 
>> 
>>> Alex Tweedly alex at tweedly.net
>>> Mon Jul 27 15:47:12 EDT 2020
>>>   Previous message (by thread): Object naming
>>>   Next message (by thread): Object naming
>>>   Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
>>>> There are many ways to refer to things.  The simplest is to use 
>>>> unambiguous names for things that matter.
>>>> 
>>> Is there an unambiguous name in this case ? And if so, what is it :-) ?
>>> A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
>>> contains a rectangle "R". (btw - "B" also may contain a subgroup "C", and 
>>> it too will have a rectangle "R", and ).
>>> There is an unambiguous name for the 'most nested' "R", but there doesn't 
>>> seem to be for the other "R"s. I had expected (or perhaps just hoped) that 
>>> using a long name would first try to find an exact match, and if that 
>>> failed it would then find the closest inexact match - but that sadly was 
>>> just a hope.
>>> I could (and probably will) use IDs but that doesn't work for duplicating 
>>> the group - you need to either go in and adjust a script / custom property 
>>> OR have the group's script find the IDs.
>>> Or - am I'm missing something ?
>>> Alex.
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Jerry Jensen via use-livecode
Dave’s not here.
https://www.youtube.com/watch?v=rtDAK7Umk7A

> On Jul 27, 2020, at 10:24 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Consider a simplified problem statement:
> 
> You have two objects of the same type in a container, and you want to tell 
> them apart but had given them the same name.
> 
> 
> 
>   Too Many Daves
>   by Dr. Seuss
> 
>   Did I ever tell you that Mrs. McCave
>   Had twenty-three sons and she named them all Dave?
>   Well, she did. And that wasn't a smart thing to do.
>   You see, when she wants one and calls out, "Yoo-Hoo!
>   Come into the house, Dave!" she doesn't get one.
>   All twenty-three Daves of hers come on the run!
>   This makes things quite difficult at the McCaves'
>   As you can imagine, with so many Daves.
>   And often she wishes that, when they were born,
>   She had named one of them Bodkin Van Horn
>   And one of them Hoos-Foos. And one of them Snimm.
>   And one of them Hot-Shot. And one Sunny Jim.
>   And one of them Shadrack. And one of them Blinkey.
>   And one of them Stuffy. And one of them Stinkey.
>   Another one Putt-Putt. Another one Moon Face.
>   Another one Marvin O'Gravel Balloon Face.
>   And one of them Ziggy. And one Soggy Muff.
>   One Buffalo Bill. And one Biffalo Buff.
>   And one of them Sneepy. And one Weepy Weed.
>   And one Paris Garters. And one Harris Tweed.
>   And one of them Sir Michael Carmichael Zutt
>   And one of them Oliver Boliver Butt
>   And one of them Zanzibar Buck-Buck McFate ...
>   But she didn't do it. And now it's too late.
> 
> --
> Richard Gaskin
> Fourth World Systems
> 
> 
>> Alex Tweedly alex at tweedly.net
>> Mon Jul 27 15:47:12 EDT 2020
>>Previous message (by thread): Object naming
>>Next message (by thread): Object naming
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
>>> There are many ways to refer to things.  The simplest is to use unambiguous 
>>> names for things that matter.
>>> 
>> Is there an unambiguous name in this case ? And if so, what is it :-) ?
>> A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
>> contains a rectangle "R". (btw - "B" also may contain a subgroup "C", and it 
>> too will have a rectangle "R", and ).
>> There is an unambiguous name for the 'most nested' "R", but there doesn't 
>> seem to be for the other "R"s. I had expected (or perhaps just hoped) that 
>> using a long name would first try to find an exact match, and if that failed 
>> it would then find the closest inexact match - but that sadly was just a 
>> hope.
>> I could (and probably will) use IDs but that doesn't work for duplicating 
>> the group - you need to either go in and adjust a script / custom property 
>> OR have the group's script find the IDs.
>> Or - am I'm missing something ?
>> Alex.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Martin Koob via use-livecode
From Kids in the Hall

https://www.youtube.com/watch?v=8nvzEqsZIGo

Martin


> On Jul 28, 2020, at 2:32 PM, Jim Lambert via use-livecode 
>  wrote:
> 
> Zanzibar Buck-Buck McFate was my lawyer.
> One day I asked if I could call him Zanz.
> He said, “Nah. Just call me Dave!”
> 
> Jim Lambert
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Jim Lambert via use-livecode
Zanzibar Buck-Buck McFate was my lawyer.
One day I asked if I could call him Zanz.
He said, “Nah. Just call me Dave!”

Jim Lambert


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode



On 28/07/2020 08:27, Curry Kenworthy via use-livecode wrote:


Alex:

> Using unambiguous short names prevents behaviour scripts
> that references child controls completely

Sure about that? (Option A)

Yes, I think I am. At least, it prevents using names of the child 
objects in the script. The other solution using cached IDs works in a 
behaviour script. But I still can't see a way to do it using names.


Give me one more clue please; I'd really like to use option A.


> Inside A, there is a rect called "R" and also a group called "B"
> inside B there is a rect called "R"

Or put the "direct" R in a subgroup also. (Option B)
A-B-R vs A-C-R.

No, unfortunately option B doesn't work. Remember that A and B are 
instances of the same group, so when you introduce the extra group level 
in A, you do the same in B; i.e. it's now A-C-R versus A-B-C-R


And again Livecode's "incomplete" name matching will give whichever one 
has a lower layer number.


Verified:
> *put*thelongnameofgrc"R1"ofgrp"A"
... graphic "R1" of group "C" of group "B" of group "A" of card id 1002 
of stack "Untitled 1"


when A-B is lower than A-C (which it has to be to avoid obscuring it).


So I'm going to abandon this idea - I can go back to a different 
solution which allows behaviour scripts, but requires slightly more 
setup. Not quite so easy to use (initially), but probably easier to 
continue to use in the long run.


Many thanks,

Alex.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode
Thanks Martin. That does indeed work (might need tweaking for some more 
complex cases).


However, it goes through all controls on the card - the same effect is 
achieved without the performance risk using the childControlIDs, as in



function idOfChild pLongID, pShortName
  repeat for each line L in the childControlIDs of  pLongID
 if the short name of control ID L = pShortName then return the 
long id of control ID L

  end repeat
end idOfChild

I'm currently using that - but I'm convinced by Richard and Dr Seuss 
that I'm on the wrong path and will try a redesign.


Alex.

On 28/07/2020 04:04, Martin Koob wrote:

Hi Alex

You could use the owner of the control in conjunction with the name of 
the control to distinguish between the two graphic’s named ‘R’.


I did that  for the  simple case in your example  but may not work 
with something more complex.


I created a stack with the same hierarchy of graphics and groups and 
using the following scripts in a button I placed on the card I can 
distinguish between  graphic A - R and B - R.


*
*

*on* mouseup

*ask*“enter owner name/control name/control colour"

*put* it into tResponse

*set*theitemdelimiterto"/"

*put*item1of tResponse into tOwner

*put*item2of tResponse into tControl

*put*item3of tResponse into tControlColour

*put* findTargetControl(tOwner, tControl) into tTargetControl

*set*thebackgroundcolorofcontrol tTargetControl 
of*group*"A"to tControlColour


*end* mouseup


*function* findTargetControl pOwner, pControl

*put*thenumberofcontrolsof*group*"A"into tIndex

*repeat* with tControl = 1to tIndex

*if* theshortnameofcontrol tControl of*group*"A" = pControl *then*

*if* theshortnameoftheownerofcontrol tControl of*group*"A" = pOwner *then*

*exit* *repeat*

*end* *if*

*end* *if*

*end* *repeat*

*return* tControl

*end* findTargetControl


Martin Koob



On Jul 27, 2020, at 8:47 PM, Alex Tweedly via use-livecode 
> wrote:



On 27/07/2020 21:26, Curry Kenworthy via use-livecode wrote:


Use unambiguous SHORT names!


Thanks, but ...

Yes, using unambiguous SHORT names solves this naming problem, but 
introduces other problems. In particular, this group script should 
(probably) be a behaviour script, since the group will be 
instantiated multiple times and will in the future need updating for 
enhancements or even (Heaven forfend!) bug fixes.


Using unambiguous short names prevents behaviour scripts that 
references child controls completely, and even if I simply used 
normal scripts which were replicated for each instance, I'd still 
need to go through the script to change all the references to the 
child control names (a pain, and source of possible future errors).


For now, I'm caching the IDs of the direct child controls in 
script-local variables in each instance of the group. If I find a 
name-based way that works reliably and allows behaviour scripts, I'll 
change - but this method works.


I'll have this group ready for release soon (or soon-ish) so y'all'll 
be able to see how it turned out :-)


Thanks again everyone,

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com 
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Alex Tweedly via use-livecode



On 28/07/2020 06:24, Richard Gaskin via use-livecode wrote:

Consider a simplified problem statement:

You have two objects of the same type in a container, and you want to 
tell them apart but had given them the same name.



+100

OK, when I stop laughing, I will admit I am convinced :-)

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Richmond via use-livecode

You are asking for trouble.

Think about something as goofy and as simple as this:

Inside A1, there is a rect called "R1" and also a group called "B1"
inside B1 there is a rect called "R2" . . .

Am I missing something?

Richmond.

On 28.07.20 10:27, Curry Kenworthy via use-livecode wrote:


Alex:

> Using unambiguous short names prevents behaviour scripts
> that references child controls completely

Sure about that? (Option A)

> Inside A, there is a rect called "R" and also a group called "B"
> inside B there is a rect called "R"

Or put the "direct" R in a subgroup also. (Option B)
A-B-R vs A-C-R.

Richard:

> One Buffalo Bill. And one Biffalo Buff.

I like that one.

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread scott--- via use-livecode
So Alex, the takeaway here seems to be that once you name your child objects… 
“now it’s too late.”

While reading this out aloud, I taught my classes of 2nd and 3rd graders to 
say, “Noo” after the second line. And I usually paused to let the class 
finish Oliver Boliver’s name.

—
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web   https://elementarysoftware.com/
--



> On Jul 27, 2020, at 10:24 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Consider a simplified problem statement:
> 
> You have two objects of the same type in a container, and you want to tell 
> them apart but had given them the same name.
> 
> 
> 
>   Too Many Daves
>   by Dr. Seuss
> 
>   Did I ever tell you that Mrs. McCave
>   Had twenty-three sons and she named them all Dave?
>   Well, she did. And that wasn't a smart thing to do.
>   You see, when she wants one and calls out, "Yoo-Hoo!
>   Come into the house, Dave!" she doesn't get one.
>   All twenty-three Daves of hers come on the run!
>   This makes things quite difficult at the McCaves'
>   As you can imagine, with so many Daves.
>   And often she wishes that, when they were born,
>   She had named one of them Bodkin Van Horn
>   And one of them Hoos-Foos. And one of them Snimm.
>   And one of them Hot-Shot. And one Sunny Jim.
>   And one of them Shadrack. And one of them Blinkey.
>   And one of them Stuffy. And one of them Stinkey.
>   Another one Putt-Putt. Another one Moon Face.
>   Another one Marvin O'Gravel Balloon Face.
>   And one of them Ziggy. And one Soggy Muff.
>   One Buffalo Bill. And one Biffalo Buff.
>   And one of them Sneepy. And one Weepy Weed.
>   And one Paris Garters. And one Harris Tweed.
>   And one of them Sir Michael Carmichael Zutt
>   And one of them Oliver Boliver Butt
>   And one of them Zanzibar Buck-Buck McFate ...
>   But she didn't do it. And now it's too late.
> 
> --
> Richard Gaskin
> Fourth World Systems
> 
> 
>> Alex Tweedly alex at tweedly.net
>> Mon Jul 27 15:47:12 EDT 2020
>>Previous message (by thread): Object naming
>>Next message (by thread): Object naming
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
>>> There are many ways to refer to things.  The simplest is to use unambiguous 
>>> names for things that matter.
>>> 
>> Is there an unambiguous name in this case ? And if so, what is it :-) ?
>> A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
>> contains a rectangle "R". (btw - "B" also may contain a subgroup "C", and it 
>> too will have a rectangle "R", and ).
>> There is an unambiguous name for the 'most nested' "R", but there doesn't 
>> seem to be for the other "R"s. I had expected (or perhaps just hoped) that 
>> using a long name would first try to find an exact match, and if that failed 
>> it would then find the closest inexact match - but that sadly was just a 
>> hope.
>> I could (and probably will) use IDs but that doesn't work for duplicating 
>> the group - you need to either go in and adjust a script / custom property 
>> OR have the group's script find the IDs.
>> Or - am I'm missing something ?
>> Alex.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-28 Thread Curry Kenworthy via use-livecode



Alex:

> Using unambiguous short names prevents behaviour scripts
> that references child controls completely

Sure about that? (Option A)

> Inside A, there is a rect called "R" and also a group called "B"
> inside B there is a rect called "R"

Or put the "direct" R in a subgroup also. (Option B)
A-B-R vs A-C-R.

Richard:

> One Buffalo Bill. And one Biffalo Buff.

I like that one.

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread JB via use-livecode
That is really cool, Richard!
JB

Sent from my iPad

> On Jul 27, 2020, at 10:26 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Consider a simplified problem statement:
> 
> You have two objects of the same type in a container, and you want to tell 
> them apart but had given them the same name.
> 
> 
> 
>   Too Many Daves
>   by Dr. Seuss
> 
>   Did I ever tell you that Mrs. McCave
>   Had twenty-three sons and she named them all Dave?
>   Well, she did. And that wasn't a smart thing to do.
>   You see, when she wants one and calls out, "Yoo-Hoo!
>   Come into the house, Dave!" she doesn't get one.
>   All twenty-three Daves of hers come on the run!
>   This makes things quite difficult at the McCaves'
>   As you can imagine, with so many Daves.
>   And often she wishes that, when they were born,
>   She had named one of them Bodkin Van Horn
>   And one of them Hoos-Foos. And one of them Snimm.
>   And one of them Hot-Shot. And one Sunny Jim.
>   And one of them Shadrack. And one of them Blinkey.
>   And one of them Stuffy. And one of them Stinkey.
>   Another one Putt-Putt. Another one Moon Face.
>   Another one Marvin O'Gravel Balloon Face.
>   And one of them Ziggy. And one Soggy Muff.
>   One Buffalo Bill. And one Biffalo Buff.
>   And one of them Sneepy. And one Weepy Weed.
>   And one Paris Garters. And one Harris Tweed.
>   And one of them Sir Michael Carmichael Zutt
>   And one of them Oliver Boliver Butt
>   And one of them Zanzibar Buck-Buck McFate ...
>   But she didn't do it. And now it's too late.
> 
> --
> Richard Gaskin
> Fourth World Systems
> 
> 
>> Alex Tweedly alex at tweedly.net
>> Mon Jul 27 15:47:12 EDT 2020
>>Previous message (by thread): Object naming
>>Next message (by thread): Object naming
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
>>> There are many ways to refer to things.  The simplest is to use unambiguous 
>>> names for things that matter.
>>> 
>> Is there an unambiguous name in this case ? And if so, what is it :-) ?
>> A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
>> contains a rectangle "R". (btw - "B" also may contain a subgroup "C", and it 
>> too will have a rectangle "R", and ).
>> There is an unambiguous name for the 'most nested' "R", but there doesn't 
>> seem to be for the other "R"s. I had expected (or perhaps just hoped) that 
>> using a long name would first try to find an exact match, and if that failed 
>> it would then find the closest inexact match - but that sadly was just a 
>> hope.
>> I could (and probably will) use IDs but that doesn't work for duplicating 
>> the group - you need to either go in and adjust a script / custom property 
>> OR have the group's script find the IDs.
>> Or - am I'm missing something ?
>> Alex.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Jerry Jensen via use-livecode
+100 to Mr. Gaskin!

> On Jul 27, 2020, at 10:24 PM, Richard Gaskin via use-livecode 
>  wrote:
> 
> Consider a simplified problem statement:
> 
> You have two objects of the same type in a container, and you want to tell 
> them apart but had given them the same name.
> 
> 
> 
>   Too Many Daves
>   by Dr. Seuss
> 
>   Did I ever tell you that Mrs. McCave
>   Had twenty-three sons and she named them all Dave?
>   Well, she did. And that wasn't a smart thing to do.
>   You see, when she wants one and calls out, "Yoo-Hoo!
>   Come into the house, Dave!" she doesn't get one.
>   All twenty-three Daves of hers come on the run!
>   This makes things quite difficult at the McCaves'
>   As you can imagine, with so many Daves.
>   And often she wishes that, when they were born,
>   She had named one of them Bodkin Van Horn
>   And one of them Hoos-Foos. And one of them Snimm.
>   And one of them Hot-Shot. And one Sunny Jim.
>   And one of them Shadrack. And one of them Blinkey.
>   And one of them Stuffy. And one of them Stinkey.
>   Another one Putt-Putt. Another one Moon Face.
>   Another one Marvin O'Gravel Balloon Face.
>   And one of them Ziggy. And one Soggy Muff.
>   One Buffalo Bill. And one Biffalo Buff.
>   And one of them Sneepy. And one Weepy Weed.
>   And one Paris Garters. And one Harris Tweed.
>   And one of them Sir Michael Carmichael Zutt
>   And one of them Oliver Boliver Butt
>   And one of them Zanzibar Buck-Buck McFate ...
>   But she didn't do it. And now it's too late.
> 
> --
> Richard Gaskin
> Fourth World Systems
> 
> 
>> Alex Tweedly alex at tweedly.net
>> Mon Jul 27 15:47:12 EDT 2020
>>Previous message (by thread): Object naming
>>Next message (by thread): Object naming
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>> On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
>>> There are many ways to refer to things.  The simplest is to use unambiguous 
>>> names for things that matter.
>>> 
>> Is there an unambiguous name in this case ? And if so, what is it :-) ?
>> A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
>> contains a rectangle "R". (btw - "B" also may contain a subgroup "C", and it 
>> too will have a rectangle "R", and ).
>> There is an unambiguous name for the 'most nested' "R", but there doesn't 
>> seem to be for the other "R"s. I had expected (or perhaps just hoped) that 
>> using a long name would first try to find an exact match, and if that failed 
>> it would then find the closest inexact match - but that sadly was just a 
>> hope.
>> I could (and probably will) use IDs but that doesn't work for duplicating 
>> the group - you need to either go in and adjust a script / custom property 
>> OR have the group's script find the IDs.
>> Or - am I'm missing something ?
>> Alex.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Richard Gaskin via use-livecode

Consider a simplified problem statement:

You have two objects of the same type in a container, and you want to 
tell them apart but had given them the same name.




   Too Many Daves
   by Dr. Seuss

   Did I ever tell you that Mrs. McCave
   Had twenty-three sons and she named them all Dave?
   Well, she did. And that wasn't a smart thing to do.
   You see, when she wants one and calls out, "Yoo-Hoo!
   Come into the house, Dave!" she doesn't get one.
   All twenty-three Daves of hers come on the run!
   This makes things quite difficult at the McCaves'
   As you can imagine, with so many Daves.
   And often she wishes that, when they were born,
   She had named one of them Bodkin Van Horn
   And one of them Hoos-Foos. And one of them Snimm.
   And one of them Hot-Shot. And one Sunny Jim.
   And one of them Shadrack. And one of them Blinkey.
   And one of them Stuffy. And one of them Stinkey.
   Another one Putt-Putt. Another one Moon Face.
   Another one Marvin O'Gravel Balloon Face.
   And one of them Ziggy. And one Soggy Muff.
   One Buffalo Bill. And one Biffalo Buff.
   And one of them Sneepy. And one Weepy Weed.
   And one Paris Garters. And one Harris Tweed.
   And one of them Sir Michael Carmichael Zutt
   And one of them Oliver Boliver Butt
   And one of them Zanzibar Buck-Buck McFate ...
   But she didn't do it. And now it's too late.

--
 Richard Gaskin
 Fourth World Systems



Alex Tweedly alex at tweedly.net
Mon Jul 27 15:47:12 EDT 2020

    Previous message (by thread): Object naming
    Next message (by thread): Object naming
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
There are many ways to refer to things.  The simplest is to use 
unambiguous names for things that matter.



Is there an unambiguous name in this case ? And if so, what is it :-) ?

A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
contains a rectangle "R". (btw - "B" also may contain a subgroup "C", 
and it too will have a rectangle "R", and ).


There is an unambiguous name for the 'most nested' "R", but there 
doesn't seem to be for the other "R"s. I had expected (or perhaps just 
hoped) that using a long name would first try to find an exact match, 
and if that failed it would then find the closest inexact match - but 
that sadly was just a hope.


I could (and probably will) use IDs but that doesn't work for 
duplicating the group - you need to either go in and adjust a script / 
custom property OR have the group's script find the IDs.


Or - am I'm missing something ?

Alex.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Martin Koob via use-livecode
Hi Alex

You could use the owner of the control in conjunction with the name of the 
control to distinguish between the two graphic’s named ‘R’.

I did that  for the  simple case in your example  but may not work with 
something more complex.

I created a stack with the same hierarchy of graphics and groups and using the 
following scripts in a button I placed on the card I can distinguish between  
graphic A - R and B - R.


on mouseup

ask “enter owner name/control name/control colour"

put it into tResponse 

set the itemdelimiter to "/"

put item 1 of tResponse into tOwner

put item 2 of tResponse into tControl

put item 3 of tResponse into tControlColour

put findTargetControl(tOwner, tControl) into tTargetControl

set the backgroundcolor of control tTargetControl of group "A" to tControlColour

end mouseup


function findTargetControl pOwner, pControl

put the number of controls  of group "A" into tIndex

repeat with tControl = 1 to tIndex

if the short name of control tControl of group "A" = pControl then

if the short name of the owner of control tControl of group "A" = pOwner then

exit repeat

end if

end if

end repeat

return tControl

end findTargetControl


Martin Koob



> On Jul 27, 2020, at 8:47 PM, Alex Tweedly via use-livecode 
>  wrote:
> 
> 
> On 27/07/2020 21:26, Curry Kenworthy via use-livecode wrote:
>> 
>> Use unambiguous SHORT names!
>> 
> Thanks, but ...
> 
> Yes, using unambiguous SHORT names solves this naming problem, but introduces 
> other problems. In particular, this group script should (probably) be a 
> behaviour script, since the group will be instantiated multiple times and 
> will in the future need updating for enhancements or even (Heaven forfend!) 
> bug fixes.
> 
> Using unambiguous short names prevents behaviour scripts that references 
> child controls completely, and even if I simply used normal scripts which 
> were replicated for each instance, I'd still need to go through the script to 
> change all the references to the child control names (a pain, and source of 
> possible future errors).
> 
> For now, I'm caching the IDs of the direct child controls in script-local 
> variables in each instance of the group. If I find a name-based way that 
> works reliably and allows behaviour scripts, I'll change - but this method 
> works.
> 
> I'll have this group ready for release soon (or soon-ish) so y'all'll be able 
> to see how it turned out :-)
> 
> Thanks again everyone,
> 
> Alex.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode



On 27/07/2020 21:26, Curry Kenworthy via use-livecode wrote:


Use unambiguous SHORT names!


Thanks, but ...

Yes, using unambiguous SHORT names solves this naming problem, but 
introduces other problems. In particular, this group script should 
(probably) be a behaviour script, since the group will be instantiated 
multiple times and will in the future need updating for enhancements or 
even (Heaven forfend!) bug fixes.


Using unambiguous short names prevents behaviour scripts that references 
child controls completely, and even if I simply used normal scripts 
which were replicated for each instance, I'd still need to go through 
the script to change all the references to the child control names (a 
pain, and source of possible future errors).


For now, I'm caching the IDs of the direct child controls in 
script-local variables in each instance of the group. If I find a 
name-based way that works reliably and allows behaviour scripts, I'll 
change - but this method works.


I'll have this group ready for release soon (or soon-ish) so y'all'll be 
able to see how it turned out :-)


Thanks again everyone,

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Curry Kenworthy via use-livecode



Richard:

> The simplest is to use unambiguous names

+1!

Alex:

> Is there an unambiguous name in this case ?

Use unambiguous SHORT names!

Alex:

> (i.e. A-R, not A-B-R)

+1!

Best wishes,

Curry Kenworthy

Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
http://livecodeconsulting.com/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode

On 27/07/2020 16:33, Richard Gaskin via use-livecode wrote:
There are many ways to refer to things.  The simplest is to use 
unambiguous names for things that matter.



Is there an unambiguous name in this case ? And if so, what is it :-) ?

A group "A" contains a rectangle "R", and a (sub)group "B". "B" also 
contains a rectangle "R". (btw - "B" also may contain a subgroup "C", 
and it too will have a rectangle "R", and ).


There is an unambiguous name for the 'most nested' "R", but there 
doesn't seem to be for the other "R"s. I had expected (or perhaps just 
hoped) that using a long name would first try to find an exact match, 
and if that failed it would then find the closest inexact match - but 
that sadly was just a hope.


I could (and probably will) use IDs but that doesn't work for 
duplicating the group - you need to either go in and adjust a script / 
custom property OR have the group's script find the IDs.


Or - am I'm missing something ?

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Alex Tweedly via use-livecode

Thanks Mark and Andre.

Mark's description of the solution is correct - but in my situation it's 
not a solution.


The sub-groups (B in my earlier example) are opaque - they have 
coloured, filled backdrops so that they can capture e.g. mouseMove 
messages, so they need to be opaque. Therefore, I can't simply re-layer 
so that the 'direct' graphics are behind (below) the groups.


The custom properties 'selector' idea is interesting - I'll need to mull 
it over some more.


I'm currently thinking of something like

function idOfChild pLongID, pShortName
  repeat for each line L in the childControlIDs of  pLongID
 if the short name of control ID L = pShortName then return the 
long id of control ID L

  end repeat
end idOfChild

unless someone sees a problem with that. (And of course I'll do that 
once and cache the values for continuing use).


Alex.

On 27/07/2020 15:40, Andre Garzia via use-livecode wrote:


Alex,

I think that Mark solution is the correct one but I couldn't resist telling
you some other idea, one that is only applicable if performance is not a
problem.

You can add custom properties to controls you want to find later and then
look for them by looping everyone in the card. A reusable short function
can be created with whatever letter you want, like "q", and code similar 
totrolIDs of
this:

function q selector, value
   repeat with x = 1 to the number of controls in this card
 if the selector of control x of this card is value then
   return the long id of control x of this card
 end if
   end repeat
end function

And then you can go:

put q("blue-rect", "true") into tLongID

You can even have something like "qq" that returns a list of long ids for
all the controls that match that query. Caching these results is the best
architecture, on preOpenCard you can find all the controls you'll need and
place them in script local arrays, then all the functions that need them
can peek into those arrays.

It is a bit convoluted but allows for some clever programming. Remembering
that "clever" is one of the trickster spirits of the software development
world.

Best
A

On Mon, 27 Jul 2020 at 01:33, Alex Tweedly via use-livecode <
use-livecode@lists.runrev.com> wrote:


I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A -
B - R) ?

If I say
 grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
 grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the
morning I would be able to figure it out).

Help! Please !

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Richard Gaskin via use-livecode
There are many ways to refer to things.  The simplest is to use 
unambiguous names for things that matter.


--
 Richard Gaskin
 Fourth World Systems


Alex Tweedly wrote:


I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A - 
B - R) ?


If I say
grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the 
morning I would be able to figure it out).


Help! Please !

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-27 Thread Andre Garzia via use-livecode
Alex,

I think that Mark solution is the correct one but I couldn't resist telling
you some other idea, one that is only applicable if performance is not a
problem.

You can add custom properties to controls you want to find later and then
look for them by looping everyone in the card. A reusable short function
can be created with whatever letter you want, like "q", and code similar to
this:

function q selector, value
  repeat with x = 1 to the number of controls in this card
if the selector of control x of this card is value then
  return the long id of control x of this card
end if
  end repeat
end function

And then you can go:

put q("blue-rect", "true") into tLongID

You can even have something like "qq" that returns a list of long ids for
all the controls that match that query. Caching these results is the best
architecture, on preOpenCard you can find all the controls you'll need and
place them in script local arrays, then all the functions that need them
can peek into those arrays.

It is a bit convoluted but allows for some clever programming. Remembering
that "clever" is one of the trickster spirits of the software development
world.

Best
A

On Mon, 27 Jul 2020 at 01:33, Alex Tweedly via use-livecode <
use-livecode@lists.runrev.com> wrote:

> I think my head is melting :-)
>
> I have a group called 'A'.
>
> Inside A, there is a rect called "R" and also a group called "B"
>
> inside B there is a rect called "R"
>
> How do I refer unambiguously to the first rectangle (i.e. A - R, not A -
> B - R) ?
>
> If I say
> grc "R" of grp "B" of grp A
> then I unambiguously get A-B-R; but if I say simply
> grc "R" of grp "A"
> then I *also* get A-B-R.
>
> There must be a way to do this (and maybe if it wasn't nearly 2 in the
> morning I would be able to figure it out).
>
> Help! Please !
>
> Alex.
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
https://www.andregarzia.com 
Want to support me? Buy me a coffee at https://ko-fi.com/andregarzia
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming

2020-07-26 Thread Mark Wieder via use-livecode

On 7/26/20 5:31 PM, Alex Tweedly via use-livecode wrote:

I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A - 
B - R) ?


If I say
    grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
    grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the 
morning I would be able to figure it out).


Help! Please !


Sounds like a layering problem - the rect in group B is being 
encountered first. I think if you relayer it so that group B has a 
higher (later) layer number than the rect outside the group you'll get 
what you want.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Object naming

2020-07-26 Thread Alex Tweedly via use-livecode

I think my head is melting :-)

I have a group called 'A'.

Inside A, there is a rect called "R" and also a group called "B"

inside B there is a rect called "R"

How do I refer unambiguously to the first rectangle (i.e. A - R, not A - 
B - R) ?


If I say
   grc "R" of grp "B" of grp A
then I unambiguously get A-B-R; but if I say simply
   grc "R" of grp "A"
then I *also* get A-B-R.

There must be a way to do this (and maybe if it wasn't nearly 2 in the 
morning I would be able to figure it out).


Help! Please !

Alex.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-08 Thread Bob Earp
Pete, I wouldn't bother adding such complexity.  If your naming convention is 
good then others will just use it.  If it's bad you need to change it ;-)

And as far as those that just want to do their own thing, to hell with them, 
they shouldn't be using your tool in the first place !!

best, Bob...

Pete wrote:

> My concern is that I'm imposing my naming convention on anyone who wants to
> make use of the tool.  Whether you'd be willing to give up your naming
> conventions in exchange for the productivity gains you'll get from using the
> tool - that's the question.

Bob Earp
White Rock, British Columbia.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-08 Thread Bob Earp
By all means Richard, I'd be honored.

best, Bob...


> That's a great set of rules, Bob.
> 
> May I have your permission to include them in an update to my naming 
> conventions article (with attribution, of course)?
> 
> --
>  Richard Gaskin
>  Fourth World

Bob Earp
White Rock, British Columbia.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Pete
Thanks Mike, I'll be in touch in the next couple of weeks.
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Fri, Oct 7, 2011 at 6:21 PM, Mike Felker  wrote:

> That sounds like a great tool. I would love to help beta test it.
>
> Mike
>
> Sent from my iPad
>
> On Oct 7, 2011, at 12:54 PM, Pete  wrote:
>
> > Thanks for the thoughts Bob.
> >
> > For those who have replied, here's the reason behind the question.
> >
> > I'm about to ask for beta testers for an LC tool that greatly speeds up
> the
> > development of applications that use SQL databases.  Part of the tool is
> a
> > palette of controls that you can drag and drop onto your cards, answer a
> > couple of easy questions and the control will be linked to your database.
> > Right now, I use a naming convention for controls so that the tool's
> > runtime library can recognize controls that are significant to it.
> >
> > My concern is that I'm imposing my naming convention on anyone who wants
> to
> > make use of the tool.  Whether you'd be willing to give up your naming
> > conventions in exchange for the productivity gains you'll get from using
> the
> > tool - that's the question.
> >
> > I'm considering providing an alternative by using a custom property of
> the
> > control to store the info I need and let people name the controls
> according
> > to their own conventions.  But that is a fair amount of coding and
> retesting
> > to be done so I thought I would try to gauge the sentiment on naming
> > conventions before starting down that path.  Hopefully, that doesn't
> break
> > any forum rules.
> >
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> >
> >
> >
> >
> > On Fri, Oct 7, 2011 at 9:15 AM, Bob Earp  wrote:
> >
> >> Pete,
> >> It's a great question, but the last time this was asked on the list I
> think
> >> the discussion went on for three lifetimes (in use-livecode list years)
> on
> >> what exactly should be the standard to use.  It seems there's more and
> >> different naming conventions in the world than Tim Hortons has served
> cups
> >> of coffee, so if you are trying to automate layout based on what others
> use
> >> you're likely to discover the meaning of life, the universe and
> everything
> >> before completing half of it ;-)
> >>
> >> Richard Gaskin's article is a great start, and I think that most of us
> that
> >> have coded for a number of years have done something similar.
>  Personally I
> >> think there are really only three things one needs to follow;
> >>
> >> 1. Don't worry about what others do, just name everything in a format
> that
> >> really makes sense to you and your team today, and in the future.
> >> 2. Keep the names as short and uncomplicated as possible.
> >> 3. Write down what your naming convention standards are so that others
> can
> >> refer to it, and check those standards with your team on a regular basis
> to
> >> make sure it continues to work for them.
> >>
> >> Naming is only a way of better understanding what somebody was trying to
> do
> >> in their script, and that somebody is likely you in the future !!  So,
> don't
> >> forget comments which are as important but generally considered as
> >> kindergarden practice by self proclaimed expert scripters ;-)
> >>
> >> best, Bob...
> >>
> >>
> >>
> >>> From: Pete 
> >>> To: How to use LiveCode 
> >>> Subject: Object Naming Conventions
> >>> Message-ID:
> >>>  <
> >> cabx6j9mopo_9zn3+5usefnp-wyt8w2xfzu1lavp1mdxhuyb...@mail.gmail.com>
> >>> Content-Type: text/plain; charset=ISO-8859-1
> >>>
> >>> I vaguely remember a thread on this topic a while back.  I'm interested
> >> in
> >>> what naming conventions people have for stacks/cards/controls, if any.
> >>>
> >>> This is in connection with a project I'm working on to automate laying
> >> out
> >>> controls on a card.  I'm currently using a naming convention of my own
> >> but
> >>> I'd like to provide a way for other conventions to be used, in
> particular
> >>> the use of prefix or suffix characters in names of different types of
> >>> objects.
> >>>
> >>> Any input is most welcome.
> >

Re: Object naming conventions

2011-10-07 Thread Mike Felker
That sounds like a great tool. I would love to help beta test it.

Mike

Sent from my iPad

On Oct 7, 2011, at 12:54 PM, Pete  wrote:

> Thanks for the thoughts Bob.
> 
> For those who have replied, here's the reason behind the question.
> 
> I'm about to ask for beta testers for an LC tool that greatly speeds up the
> development of applications that use SQL databases.  Part of the tool is a
> palette of controls that you can drag and drop onto your cards, answer a
> couple of easy questions and the control will be linked to your database.
> Right now, I use a naming convention for controls so that the tool's
> runtime library can recognize controls that are significant to it.
> 
> My concern is that I'm imposing my naming convention on anyone who wants to
> make use of the tool.  Whether you'd be willing to give up your naming
> conventions in exchange for the productivity gains you'll get from using the
> tool - that's the question.
> 
> I'm considering providing an alternative by using a custom property of the
> control to store the info I need and let people name the controls according
> to their own conventions.  But that is a fair amount of coding and retesting
> to be done so I thought I would try to gauge the sentiment on naming
> conventions before starting down that path.  Hopefully, that doesn't break
> any forum rules.
> 
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Fri, Oct 7, 2011 at 9:15 AM, Bob Earp  wrote:
> 
>> Pete,
>> It's a great question, but the last time this was asked on the list I think
>> the discussion went on for three lifetimes (in use-livecode list years) on
>> what exactly should be the standard to use.  It seems there's more and
>> different naming conventions in the world than Tim Hortons has served cups
>> of coffee, so if you are trying to automate layout based on what others use
>> you're likely to discover the meaning of life, the universe and everything
>> before completing half of it ;-)
>> 
>> Richard Gaskin's article is a great start, and I think that most of us that
>> have coded for a number of years have done something similar.  Personally I
>> think there are really only three things one needs to follow;
>> 
>> 1. Don't worry about what others do, just name everything in a format that
>> really makes sense to you and your team today, and in the future.
>> 2. Keep the names as short and uncomplicated as possible.
>> 3. Write down what your naming convention standards are so that others can
>> refer to it, and check those standards with your team on a regular basis to
>> make sure it continues to work for them.
>> 
>> Naming is only a way of better understanding what somebody was trying to do
>> in their script, and that somebody is likely you in the future !!  So, don't
>> forget comments which are as important but generally considered as
>> kindergarden practice by self proclaimed expert scripters ;-)
>> 
>> best, Bob...
>> 
>> 
>> 
>>> From: Pete 
>>> To: How to use LiveCode 
>>> Subject: Object Naming Conventions
>>> Message-ID:
>>>  <
>> cabx6j9mopo_9zn3+5usefnp-wyt8w2xfzu1lavp1mdxhuyb...@mail.gmail.com>
>>> Content-Type: text/plain; charset=ISO-8859-1
>>> 
>>> I vaguely remember a thread on this topic a while back.  I'm interested
>> in
>>> what naming conventions people have for stacks/cards/controls, if any.
>>> 
>>> This is in connection with a project I'm working on to automate laying
>> out
>>> controls on a card.  I'm currently using a naming convention of my own
>> but
>>> I'd like to provide a way for other conventions to be used, in particular
>>> the use of prefix or suffix characters in names of different types of
>>> objects.
>>> 
>>> Any input is most welcome.
>>> 
>>> Pete
>>> Molly's Revenge <http://www.mollysrevenge.com>
>> 
>> 
>> 
>> Bob Earp
>> White Rock, British Columbia.
>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread Mark Wieder
Jacque-

Friday, October 7, 2011, 10:39:26 AM, you wrote:

> for me it makes my scripts harder to read.

Well, that's the purpose of a scripting convention. If what you're
doing makes it easier for you to read your scripts then you're doing
things the right way.

> We're all different. I really doubt any two of us codes the same way. :)

I don't even code the same way twice. I'm always refactoring things as
I learn more or come across clever hacks to speed things up or make my
code more readable or something.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Pete
Thanks Ken, looks like a very interesting document.
Pete
Molly's Revenge 




On Fri, Oct 7, 2011 at 1:11 PM, Ken Ray  wrote:

>
> On Oct 7, 2011, at 11:54 AM, Pete wrote:
>
> > Thanks for the thoughts Bob.
> >
> > For those who have replied, here's the reason behind the question.
> >
> > I'm about to ask for beta testers for an LC tool that greatly speeds up
> the
> > development of applications that use SQL databases.  Part of the tool is
> a
> > palette of controls that you can drag and drop onto your cards, answer a
> > couple of easy questions and the control will be linked to your database.
> > Right now, I use a naming convention for controls so that the tool's
> > runtime library can recognize controls that are significant to it.
> >
> > My concern is that I'm imposing my naming convention on anyone who wants
> to
> > make use of the tool.  Whether you'd be willing to give up your naming
> > conventions in exchange for the productivity gains you'll get from using
> the
> > tool - that's the question.
>
>
> If it helps, there was some work on this by the RunRev Interoperability
> Project at the 'revInterop' Yahoo group:
> http://tech.groups.yahoo.com/group/revInterop/.
>
> I know Richard put a mirror of the document we were working on somewhere,
> but I can't recall where, so I put it here for download/direct display:
>
>  http://www.sonsothunder.com/devres/ECMI_110.pdf
>
> It hasn't been updated in a while, but I know several developers (including
> myself, of course) that are using (most) of the specification in their own
> work.
>
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: k...@sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Ken Ray

On Oct 7, 2011, at 11:54 AM, Pete wrote:

> Thanks for the thoughts Bob.
> 
> For those who have replied, here's the reason behind the question.
> 
> I'm about to ask for beta testers for an LC tool that greatly speeds up the
> development of applications that use SQL databases.  Part of the tool is a
> palette of controls that you can drag and drop onto your cards, answer a
> couple of easy questions and the control will be linked to your database.
> Right now, I use a naming convention for controls so that the tool's
> runtime library can recognize controls that are significant to it.
> 
> My concern is that I'm imposing my naming convention on anyone who wants to
> make use of the tool.  Whether you'd be willing to give up your naming
> conventions in exchange for the productivity gains you'll get from using the
> tool - that's the question.


If it helps, there was some work on this by the RunRev Interoperability Project 
at the 'revInterop' Yahoo group: 
http://tech.groups.yahoo.com/group/revInterop/. 

I know Richard put a mirror of the document we were working on somewhere, but I 
can't recall where, so I put it here for download/direct display:

  http://www.sonsothunder.com/devres/ECMI_110.pdf

It hasn't been updated in a while, but I know several developers (including 
myself, of course) that are using (most) of the specification in their own work.


Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/  

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread J. Landman Gay

On 10/7/11 6:37 AM, Francis Nugent Dixon wrote:


Whatever you do, use a prefix to define ALL your objects,


I never do, I don't see any advantage, and for me it makes my scripts 
harder to read. It's easy to see what type an object is if you forget. 
In fact, the only consistent naming scheme I use for objects is "lbl" in 
a field name, so that I can skip label fields in repeat loops.


We're all different. I really doubt any two of us codes the same way. :)

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Pete
Thanks for the thoughts Bob.

For those who have replied, here's the reason behind the question.

I'm about to ask for beta testers for an LC tool that greatly speeds up the
development of applications that use SQL databases.  Part of the tool is a
palette of controls that you can drag and drop onto your cards, answer a
couple of easy questions and the control will be linked to your database.
 Right now, I use a naming convention for controls so that the tool's
runtime library can recognize controls that are significant to it.

My concern is that I'm imposing my naming convention on anyone who wants to
make use of the tool.  Whether you'd be willing to give up your naming
conventions in exchange for the productivity gains you'll get from using the
tool - that's the question.

I'm considering providing an alternative by using a custom property of the
control to store the info I need and let people name the controls according
to their own conventions.  But that is a fair amount of coding and retesting
to be done so I thought I would try to gauge the sentiment on naming
conventions before starting down that path.  Hopefully, that doesn't break
any forum rules.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Fri, Oct 7, 2011 at 9:15 AM, Bob Earp  wrote:

> Pete,
> It's a great question, but the last time this was asked on the list I think
> the discussion went on for three lifetimes (in use-livecode list years) on
> what exactly should be the standard to use.  It seems there's more and
> different naming conventions in the world than Tim Hortons has served cups
> of coffee, so if you are trying to automate layout based on what others use
> you're likely to discover the meaning of life, the universe and everything
> before completing half of it ;-)
>
> Richard Gaskin's article is a great start, and I think that most of us that
> have coded for a number of years have done something similar.  Personally I
> think there are really only three things one needs to follow;
>
> 1. Don't worry about what others do, just name everything in a format that
> really makes sense to you and your team today, and in the future.
> 2. Keep the names as short and uncomplicated as possible.
> 3. Write down what your naming convention standards are so that others can
> refer to it, and check those standards with your team on a regular basis to
> make sure it continues to work for them.
>
> Naming is only a way of better understanding what somebody was trying to do
> in their script, and that somebody is likely you in the future !!  So, don't
> forget comments which are as important but generally considered as
> kindergarden practice by self proclaimed expert scripters ;-)
>
> best, Bob...
>
>
>
> > From: Pete 
> > To: How to use LiveCode 
> > Subject: Object Naming Conventions
> > Message-ID:
> >   <
> cabx6j9mopo_9zn3+5usefnp-wyt8w2xfzu1lavp1mdxhuyb...@mail.gmail.com>
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > I vaguely remember a thread on this topic a while back.  I'm interested
> in
> > what naming conventions people have for stacks/cards/controls, if any.
> >
> > This is in connection with a project I'm working on to automate laying
> out
> > controls on a card.  I'm currently using a naming convention of my own
> but
> > I'd like to provide a way for other conventions to be used, in particular
> > the use of prefix or suffix characters in names of different types of
> > objects.
> >
> > Any input is most welcome.
> >
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
> Bob Earp
> White Rock, British Columbia.
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Richard Gaskin

Bob Earp wrote:


Personally I think there are really only three things one needs to follow;

1. Don't worry about what others do, just name everything in a format that 
really makes sense to you and your team today, and in the future.
2. Keep the names as short and uncomplicated as possible.
3. Write down what your naming convention standards are so that others can 
refer to it, and check those standards with your team on a regular basis to 
make sure it continues to work for them.


That's a great set of rules, Bob.

May I have your permission to include them in an update to my naming 
conventions article (with attribution, of course)?


--
 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming UnConventions

2011-10-07 Thread Richard Gaskin

dunbarx wrote:

> 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.


Damn - there goes my writing career. :)

Thank you very much for the kind words, but if you've read many of the 
lengthy posts I write you'll find they're often riddled with all sorts 
of errors.  A good friends suggests that one reason I write long posts 
is that the sheer volume of materials makes it harder to spot the 
mistakes. :)


But on this issue of "ordinal" vs "cardinal", I may be thinking of a 
more colloquial usage than perhaps programming vernacular.


It's my understanding that "ordinal" simply refers to the order or rank 
of things, such as layer numbering would impose, whether the reference 
is expressed numerically or textually (i.e., it would seem to apply to 
both "2" or "second").


"Cardinal" means "prime" or "most important", which had led me to 
sometimes use "cardinal" when describing object references by ID, since 
those are (or that is, were until very recently) immutably fixed and 
therefore the most reliable form of reference.


That said, I program in relatively few languages (these days only 
LiveCode and JavaScript; haven't touched a C compiler in many years, and 
Lisp sadly remains on my untouched to-do list), so there may be widely 
used conventions for these terms among programmers that I'm merely 
ignorant of.


In my book "ignorant" is a good word, since no one knows everything so 
all of us are ignorant of one thing or another, and being ignorant 
simply means there's something new to learn.  I'll wear that label with 
pride. :)


Is this a common convention to use "cardinal" when describing numeric 
ordering references, and "ordinal" only for their textual equivalent?


--
 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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object naming conventions

2011-10-07 Thread Bob Earp
Pete,
It's a great question, but the last time this was asked on the list I think the 
discussion went on for three lifetimes (in use-livecode list years) on what 
exactly should be the standard to use.  It seems there's more and different 
naming conventions in the world than Tim Hortons has served cups of coffee, so 
if you are trying to automate layout based on what others use you're likely to 
discover the meaning of life, the universe and everything before completing 
half of it ;-)

Richard Gaskin's article is a great start, and I think that most of us that 
have coded for a number of years have done something similar.  Personally I 
think there are really only three things one needs to follow;

1. Don't worry about what others do, just name everything in a format that 
really makes sense to you and your team today, and in the future.
2. Keep the names as short and uncomplicated as possible.
3. Write down what your naming convention standards are so that others can 
refer to it, and check those standards with your team on a regular basis to 
make sure it continues to work for them.

Naming is only a way of better understanding what somebody was trying to do in 
their script, and that somebody is likely you in the future !!  So, don't 
forget comments which are as important but generally considered as kindergarden 
practice by self proclaimed expert scripters ;-)

best, Bob...



> From: Pete 
> To: How to use LiveCode 
> Subject: Object Naming Conventions
> Message-ID:
>   
> Content-Type: text/plain; charset=ISO-8859-1
> 
> I vaguely remember a thread on this topic a while back.  I'm interested in
> what naming conventions people have for stacks/cards/controls, if any.
> 
> This is in connection with a project I'm working on to automate laying out
> controls on a card.  I'm currently using a naming convention of my own but
> I'd like to provide a way for other conventions to be used, in particular
> the use of prefix or suffix characters in names of different types of
> objects.
> 
> Any input is most welcome.
> 
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>



Bob Earp
White Rock, British Columbia.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread Pete
Rene,
I really like the idea of prefixes for handlers and functions that tell you
where they are located.  I'd probably add a prefix for handlers in a library
as well.
Pete
Molly's Revenge 




On Fri, Oct 7, 2011 at 8:44 AM, René Micout wrote:

>
> Le 7 oct. 2011 à 16:41, Richard Gaskin a écrit :
> >
> > 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.
>
> Hello Richard,
> This is my prefix :
>
> -- PRÉFIXES (types des objets) :
> --
>  ku = constante (unitaire)
>  kt = constante (tableau) > utiliser plutôt une custom property
> --
>  vg = variable globale [stack]
>  vt = variable globale (tableau) [stack]
>  vl = variable locale [script]
>  vx = variable temporaire [handler]
>  vp = paramètre [fonctions]
>  vd = variable provisoire servant au debugage
> --
>  cp = custom property
> --
>  hm = handler main stack (handler situé dans le stack principal)
>  hs = handler stack (handler situé dans le script du stack)
>  hc = handler card (handler situé dans le script de la carte)
>  hg = handler group (handler situé dans le script du groupe)
>  ho = handler object (handler situé dans le script de l'objet)
> --
>  fm = function main stack (fonction située dans le stack principal)
>  fs = function stack (fonction située dans le script du stack)
>  fc = function card (fonction située dans le script de la carte)
>  fg = function group (fonction située dans le script du groupe)
>  fo = function object (fonction située dans le script de l'objet)
>  db = fonction ou commande servant au debugage
> --
>  btn = bouton
>  fld = field
>  grp = groupe
>  sld = slider
>  lbl = label
>  img = image
>  grc = graphic
>
> I put also prefix before handler (and function) name (to see where it
> is...)
>
> Bon souvenir de Paris
> René
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Object Naming UnConventions

2011-10-07 Thread dunbarx
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 
To: use-livecode 
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  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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread René Micout

Le 7 oct. 2011 à 16:41, Richard Gaskin a écrit :
> 
> 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.

Hello Richard,
This is my prefix :

-- PRÉFIXES (types des objets) :
--
 ku = constante (unitaire)
 kt = constante (tableau) > utiliser plutôt une custom property
--
 vg = variable globale [stack]
 vt = variable globale (tableau) [stack]
 vl = variable locale [script]
 vx = variable temporaire [handler]
 vp = paramètre [fonctions]
 vd = variable provisoire servant au debugage
--
 cp = custom property
--
 hm = handler main stack (handler situé dans le stack principal)
 hs = handler stack (handler situé dans le script du stack)
 hc = handler card (handler situé dans le script de la carte)
 hg = handler group (handler situé dans le script du groupe)
 ho = handler object (handler situé dans le script de l'objet)
--
 fm = function main stack (fonction située dans le stack principal)
 fs = function stack (fonction située dans le script du stack)
 fc = function card (fonction située dans le script de la carte)
 fg = function group (fonction située dans le script du groupe)
 fo = function object (fonction située dans le script de l'objet)
 db = fonction ou commande servant au debugage
--
 btn = bouton
 fld = field
 grp = groupe
 sld = slider
 lbl = label
 img = image
 grc = graphic

I put also prefix before handler (and function) name (to see where it is...)

Bon souvenir de Paris
René

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread Mark Wieder
Richard-

Friday, October 7, 2011, 7:41:27 AM, you wrote:

> Somehow I'd gotten the idea that the "control" specifier was limited to
> ordinal references, but apparently it's not.

I do that rather extensively in PowerTools because I need an object
oriented way to deal with any type of control. Since they're all
subclassed from "control" I can deal with the base class when
accessing them, then get the first word of the name to determine the
actual type.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread Richard Gaskin

Pete wrote:

Thanks Mark, that's what I was looking for.
Pete

On Thu, Oct 6, 2011 at 6:03 PM, Mark Wieder  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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread Francis Nugent Dixon

Hi from Beautiful Brittany,

Pete, there has been a thread on this subject several
times, but I'm not against seeing it again.

Whatever you do, use a prefix to define ALL your objects,
but find a rule that suits you. Don't use a suffix, I'm
sure you will regret it.

I use a two-letter indicator (but each to his own poison !)
- only 2 letters (CAPS) and not 3, like Mark !

Custom Properties CPxxx
Global Variables  GVxxx
Local Variables   LVXXX
FieldsMyxxx
LabelsLBxxx
Buttons   BTxxx
GroupsGPxxx
Functions DFxxx

I also deliberately use  "repeat" variables : I, J, K, etc.
(old Fortran rules, but habits die hard !) It also has the
advantage of being crystal-clear !

It may take a little time to adjust to your new rules
but, if you come back to your scripts in 6 months, you
will be glad you invented them.
I agree with Mark about length of names - one word is enough !

Best Regards

-Francis

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-07 Thread René Micout
Mark,
I do almost the same...
René

Le 7 oct. 2011 à 03:03, Mark Wieder a écrit :

> 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. Mostly just a carryover from other development
> environments since they don't really do much, but they tend to trigger
> the same neuron activity so it makes it easier for me to conceptualize
> what I'm doing:
> 
> controlprefix   example
> ---
> buttons   : "btn" : "btnSave"
> radio buttons : "rdo" : "rdoOption1"
> checkboxes: "chk" : "chkShowLineNumbers"
> tab buttons   : "mnu" : "mnuMainTabForm"
> fields: "fld" : "fldHandlers"
> labels: "lbl" : "lblSourceCode"
> groups: "grp" : "grpGraphicControls"
> 
> The only other rule of thumb I have is to keep object names one word
> rather than having spaces in the middle. And of course, that rule,
> like any other rule, was made to be broken when needed.
> 
> -- 
> -Mark Wieder
> mwie...@ahsoftware.net
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Mark Wieder
Ken-

 that was supposed to read:

"Of course, each person has the style that works best for them, so use
what you like and ditch what you don't..."

> Absolutely.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Mark Wieder
Ken-

Thursday, October 6, 2011, 8:06:18 PM, you wrote:

> I tend to use prefixes like this only when they aren't already
> abbreviations for an existing object in LC.

Absolutely. I also quite often use graphic images as buttons, so I'll
go

hide graphic "btnSaveMe"

and there the "btn" reminds me of the purpose of the graphic.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Ken Ray

On Oct 6, 2011, at 8:03 PM, Mark Wieder wrote:

> controlprefix   example
> ---
> buttons   : "btn" : "btnSave"
> radio buttons : "rdo" : "rdoOption1"
> checkboxes: "chk" : "chkShowLineNumbers"
> tab buttons   : "mnu" : "mnuMainTabForm"
> fields: "fld" : "fldHandlers"
> labels: "lbl" : "lblSourceCode"
> groups: "grp" : "grpGraphicControls"

I tend to use prefixes like this only when they aren't already abbreviations 
for an existing object in LC. So for example, I would use the "lbl" prefix for 
label field names, but not the "fld" prefix since I'm already using "fld" as 
the object abbreviation:

   put fld "fldStuff" into tData  -- is a bit redundant for me
   put fld "Stuff" into tData  -- ah, that's better... :D

Of course, each person has the style that works best for them, so use what you 
like and ditch what you don't...

;)

Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/  

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Pete
Thanks Mark, that's what I was looking for.
Pete
Molly's Revenge 




On Thu, Oct 6, 2011 at 6:03 PM, Mark Wieder  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. Mostly just a carryover from other development
> environments since they don't really do much, but they tend to trigger
> the same neuron activity so it makes it easier for me to conceptualize
> what I'm doing:
>
> controlprefix   example
> ---
> buttons   : "btn" : "btnSave"
> radio buttons : "rdo" : "rdoOption1"
> checkboxes: "chk" : "chkShowLineNumbers"
> tab buttons   : "mnu" : "mnuMainTabForm"
> fields: "fld" : "fldHandlers"
> labels: "lbl" : "lblSourceCode"
> groups: "grp" : "grpGraphicControls"
>
> The only other rule of thumb I have is to keep object names one word
> rather than having spaces in the middle. And of course, that rule,
> like any other rule, was made to be broken when needed.
>
> --
> -Mark Wieder
>  mwie...@ahsoftware.net
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Mark Wieder
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. Mostly just a carryover from other development
environments since they don't really do much, but they tend to trigger
the same neuron activity so it makes it easier for me to conceptualize
what I'm doing:

controlprefix   example
---
buttons   : "btn" : "btnSave"
radio buttons : "rdo" : "rdoOption1"
checkboxes: "chk" : "chkShowLineNumbers"
tab buttons   : "mnu" : "mnuMainTabForm"
fields: "fld" : "fldHandlers"
labels: "lbl" : "lblSourceCode"
groups: "grp" : "grpGraphicControls"

The only other rule of thumb I have is to keep object names one word
rather than having spaces in the middle. And of course, that rule,
like any other rule, was made to be broken when needed.

-- 
-Mark Wieder
 mwie...@ahsoftware.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Object Naming Conventions

2011-10-06 Thread Phil Davis

Here is an excellent starting point:
http://fourthworld.com/embassy/articles/scriptstyle.html

Go to the "Naming Conventions" part.

Phil


On 10/6/11 12:23 PM, Pete wrote:

I vaguely remember a thread on this topic a while back.  I'm interested in
what naming conventions people have for stacks/cards/controls, if any.

This is in connection with a project I'm working on to automate laying out
controls on a card.  I'm currently using a naming convention of my own but
I'd like to provide a way for other conventions to be used, in particular
the use of prefix or suffix characters in names of different types of
objects.

Any input is most welcome.

Pete
Molly's Revenge
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



--
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Object Naming Conventions

2011-10-06 Thread Pete
I vaguely remember a thread on this topic a while back.  I'm interested in
what naming conventions people have for stacks/cards/controls, if any.

This is in connection with a project I'm working on to automate laying out
controls on a card.  I'm currently using a naming convention of my own but
I'd like to provide a way for other conventions to be used, in particular
the use of prefix or suffix characters in names of different types of
objects.

Any input is most welcome.

Pete
Molly's Revenge 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode