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


Sorting numbers on a datagrid

2020-07-27 Thread Heriberto Torrado via use-livecode

Dear LiveCode experts,

I have had an annoying problem with a datagrid since years ago.  Now is 
the time to fix it.


One of the columns is numeric (CustomerID). It takes the data form an 
MYSQL Database.


When I sort the data by clicking on the CustomerID column, the customer 
numbers appear as follows: 1,10,100,101 and not 1,2,3,4,5.


Do you know how to fix this problem?

Thank you very much.

Off-topic: Yesterday I bought my first Livecode Indy license. :-)
I'd like to say thanks to LiveCode Ltd for creating this awesome product.

--

Best regards/ Saludos cordiales/ Cordialement

Heriberto Torrado
​Chief Technology Officer (CTO)
​Director de informática
Directeur informatique

*NetDreams S.C.*
http://www.networkdreams.net

 Address / Dirección / Adresse:​

*USA: *538 East 85th Street, #1C Manhattan NY, NY 10028 USA
*Europe / Europa: *Paseo de la Castellana 135 10ª Planta Madrid 28024 
Spain / España


*Tel - Phone - Fax:*

Phone / Tel USA : +1 917 287 5644 / +1 646 596 8787
Phone / Tel Spain :+34 627 556 500 / + 34 91 063 74 48

   Please consider the environment before printing this email / Por 
favor considera tu responsabilidad medioambiental antes de imprimir esta 
página.


Confidentiality: The information contained in this message as well as 
the attached file(s) is confidential/privileged and is only intended for 
the person(s) to whom it is addressed. If the reader of this message is 
not the intended recipient or the employee or agent responsible for 
delivering the message to the intended recipient, or you have received 
this comunication in error, please be aware that any dissemination, 
distribution or duplication is strictly prohibited, and can be illegal, 
and please notify us immediately and return the original message to us 
at the address above. Thank you.


Confidencialidad: La información contenida en este mensaje y/o 
archivo(s) adjunto(s) es confidencial/privilegiada y está destinada a 
ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Si usted 
lee este mensaje y no es el destinatario señalado, el empleado o el 
agente responsable de entregar el mensaje al destinatario, o ha recibido 
esta comunicación por error, le informamos que está totalmente 
prohibida, y puede ser ilegal, cualquier divulgación, distribución o 
reproducción de esta comunicación, y le rogamos que nos lo notifique 
inmediatamente y nos devuelva el mensaje original a la dirección arriba 
mencionada. Gracias.


Viruses: Although we have taken steps to insure that this e-mail and 
attachments are free from any virus, we advise that in keeping with good 
computing practice, the recipient should ensure they are actually virus 
free.


Virus: Aunque hemos tomado las medidas para asegurarnos que este correo 
electrónico y sus ficheros adjuntos están libres de virus, le 
recomendamos que a efectos de mantener buenas prácticas de seguridad, el 
receptor debe asegurarse que este correo y sus ficheros adjuntos están 
libres de virus.


___
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: OAuth2 was Re: google sheets - anybody doing anything besides mergGoogle

2020-07-27 Thread Prothero@earthlearning via use-livecode
Ben,
I’d find a sample stack to be useful. I’ll leave details of what constitutes a 
“library” to others. There are some best practices, tho. What I see is usually 
a text stack with that main handlers with a sample stack that demos basic calls.

That said, if you don’t have the time to get into the niceties, whatever you 
have would be useful.

Best,
Bill

William Prothero
http://es.earthednet.org

> On Jul 27, 2020, at 10:53 AM, Ben Rubinstein via use-livecode 
>  wrote:
> 
> Hi Bill (and Neville)
> 
> Happy to post it - I'll try to do a bit of cleanup and commenting first. 
> (Honestly I think it's probably just going to be an email to the list.) Afore 
> I do, I had this question:
> 
>> (I say library - currently it's a button I copy and paste to stacks where I
>> need it, and "insert the script of". I've completely lost track of how real
>> "libraries" should be packaged. Where should I look?)
> What is the currently approved method for a "library"?
> 
> TIA,
> 
> Ben
> 
>> On 22/07/2020 20:04, Prothero@earthlearning via use-livecode wrote:
>> Ben,
>> Any chance of posting a demo stack somewhere? It sounds very useful.
>> Thanks,
>> Bill
>> William Prothero
>> http://es.earthednet.org
 On Jul 22, 2020, at 10:13 AM, Ben Rubinstein via use-livecode 
  wrote:
>>> 
>>> Ah, shame. It turned out it was (IIUC) just a change in the way Google did 
>>> their tokens which exposed a bug, now fixed, in how LC did OAuth - nothing 
>>> to do with the general API changing.
>>> 
>>> At any rate, I do have a very basic library which I use to read and write 
>>> Google sheets, in case it's of use to anyone.
>>> 
>>> (I say library - currently it's a button I copy and paste to stacks where I 
>>> need it, and "insert the script of". I've completely lost track of how real 
>>> "libraries" should be packaged. Where should I look?)
>>> 
>>> Ben
>>> 
 On 21/07/2020 14:49, Mike Kerner wrote:
 I got impatient/spooked so we went another direction.  I think we're going 
 to use other tools.
 On Thu, Jul 16, 2020 at 10:00 AM Ben Rubinstein via use-livecode 
 mailto:use-livecode@lists.runrev.com>> 
 wrote:
Hi Mike,
Brian Milby put me on to the solution for the OAuth problem:
 > Check out bug 22557 / PR 7381.
 > Line 247 of oath2.livecodescript need urlEncode removed
Are you still interested in this, or are you covered now?
regards,
Ben
On 11/03/2020 20:45, Ben Rubinstein via use-livecode wrote:
 > Hi Mike,
 >
 > I haven't forgotten, but finally found time to take a look today and
started
 > writing minimal comments, and thought I should at least test it - 
 for some
 > reason the authorisation isn't working. For whatever reason, the 
 call to
 > OAuth2 results in the error "Malformed auth code." So I can't get to
test what
 > I'm sending.
 >
 > I'm unclear whether I've done something strange or wrong, or whether
Google
 > has changed something that breaks LC's implementation. I've come 
 across
 > references which suggest that, but they date back to last year, and I
believe
 > I've used this stack in January. (I also tried using LC 9.0.4 with 
 the
same
 > result.)
 >
 > I will try to get back to this. In the meantime, have you - or 
 anyone -
found
 > issues recently with OAuth2, in particular against any of the Google 
 APIs?
 >
 > Ben
 >
 >
 > On 08/03/2020 22:22, Mike Kerner via use-livecode wrote:
 >> it might help us get started.  i'm going to probably put out an rfq 
 to
wrap
 >> the v4 rest api, because we're going to have to come to a solution, 
 either
 >> using lc or some other tool.
 >>
 >> On Sun, Mar 8, 2020 at 6:01 PM Ben Rubinstein via use-livecode <
 >> use-livecode@lists.runrev.com 
 >
wrote:
 >>
 >>> Mike,
 >>>
 >>> Very happy to share what I've got, but it's really not much - just 
 a very
 >>> thin
 >>> wrapper round Google's API - and it's undocumented, mostly rough 
 code -
 >>> copied
 >>> from one stack to the next, usually done in a tearing hurry!
 >>>
 >>> I'll try to pull something together, but please promise not to 
 judge
me...
 >>>
 >>> Ben
 >>>
 >>> On 06/03/2020 15:13, Mike Kerner via use-livecode wrote:
  Ben,
  would you send me what you've got?  I was considering paying 
 someone to
  wrap the entire v4 api and dropping mergGoogle, so any head start 
 would
 >>> be
  useful.  LC wants tribute to do the work (which is a little
disappointing
 

Re: OAuth2 was Re: google sheets - anybody doing anything besides mergGoogle

2020-07-27 Thread Ben Rubinstein via use-livecode

Hi Bill (and Neville)

Happy to post it - I'll try to do a bit of cleanup and commenting first. 
(Honestly I think it's probably just going to be an email to the list.) Afore 
I do, I had this question:



(I say library - currently it's a button I copy and paste to stacks where I
need it, and "insert the script of". I've completely lost track of how real
"libraries" should be packaged. Where should I look?)

What is the currently approved method for a "library"?

TIA,

Ben

On 22/07/2020 20:04, Prothero@earthlearning via use-livecode wrote:

Ben,
Any chance of posting a demo stack somewhere? It sounds very useful.
Thanks,
Bill

William Prothero
http://es.earthednet.org


On Jul 22, 2020, at 10:13 AM, Ben Rubinstein via use-livecode 
 wrote:

Ah, shame. It turned out it was (IIUC) just a change in the way Google did 
their tokens which exposed a bug, now fixed, in how LC did OAuth - nothing to 
do with the general API changing.

At any rate, I do have a very basic library which I use to read and write 
Google sheets, in case it's of use to anyone.

(I say library - currently it's a button I copy and paste to stacks where I need it, and 
"insert the script of". I've completely lost track of how real "libraries" 
should be packaged. Where should I look?)

Ben


On 21/07/2020 14:49, Mike Kerner wrote:
I got impatient/spooked so we went another direction.  I think we're going to 
use other tools.
On Thu, Jul 16, 2020 at 10:00 AM Ben Rubinstein via use-livecode 
mailto:use-livecode@lists.runrev.com>> wrote:
Hi Mike,
Brian Milby put me on to the solution for the OAuth problem:
 > Check out bug 22557 / PR 7381.
 > Line 247 of oath2.livecodescript need urlEncode removed
Are you still interested in this, or are you covered now?
regards,
Ben
On 11/03/2020 20:45, Ben Rubinstein via use-livecode wrote:
 > Hi Mike,
 >
 > I haven't forgotten, but finally found time to take a look today and
started
 > writing minimal comments, and thought I should at least test it - for 
some
 > reason the authorisation isn't working. For whatever reason, the call to
 > OAuth2 results in the error "Malformed auth code." So I can't get to
test what
 > I'm sending.
 >
 > I'm unclear whether I've done something strange or wrong, or whether
Google
 > has changed something that breaks LC's implementation. I've come across
 > references which suggest that, but they date back to last year, and I
believe
 > I've used this stack in January. (I also tried using LC 9.0.4 with the
same
 > result.)
 >
 > I will try to get back to this. In the meantime, have you - or anyone -
found
 > issues recently with OAuth2, in particular against any of the Google 
APIs?
 >
 > Ben
 >
 >
 > On 08/03/2020 22:22, Mike Kerner via use-livecode wrote:
 >> it might help us get started.  i'm going to probably put out an rfq to
wrap
 >> the v4 rest api, because we're going to have to come to a solution, 
either
 >> using lc or some other tool.
 >>
 >> On Sun, Mar 8, 2020 at 6:01 PM Ben Rubinstein via use-livecode <
 >> use-livecode@lists.runrev.com >
wrote:
 >>
 >>> Mike,
 >>>
 >>> Very happy to share what I've got, but it's really not much - just a 
very
 >>> thin
 >>> wrapper round Google's API - and it's undocumented, mostly rough code -
 >>> copied
 >>> from one stack to the next, usually done in a tearing hurry!
 >>>
 >>> I'll try to pull something together, but please promise not to judge
me...
 >>>
 >>> Ben
 >>>
 >>> On 06/03/2020 15:13, Mike Kerner via use-livecode wrote:
  Ben,
  would you send me what you've got?  I was considering paying someone 
to
  wrap the entire v4 api and dropping mergGoogle, so any head start 
would
 >>> be
  useful.  LC wants tribute to do the work (which is a little
disappointing
  since we financed the original external, so we sort-of hoped that it
 >>> would
  become a thing, and it would get updated as required, but crap 
happens).
 
  On Thu, Mar 5, 2020 at 6:04 PM Ben Rubinstein via use-livecode <
  use-livecode@lists.runrev.com
> wrote:
 
 > On 04/03/2020 20:37, Mike Kerner via use-livecode wrote:
 >> is anyone using anything besides mergGoogle to work with google
sheets?
 >> care to share, if you are?
 >
 > I'm just using the Google Sheets API directly from LiveCode - just
 >>> pushing
 > JSON back and forth. The API is limited, but what's there is very 
easy
 >>> to
 > work
 > with - much better than manipulating xlsx files.
 >
 > I started using it to get data from clients, and then processing data
 >>> and
 > pushing it back 

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


[ANN] This Week in LiveCode 234

2020-07-27 Thread panagiotis merakos via use-livecode
Hi all,

Read about new developments in LiveCode open source and the open source
community in today's edition of the "This Week in LiveCode" newsletter!

Read issue #234 here: https://bit.ly/3g60YXc

This is a weekly newsletter about LiveCode, focussing on what's been
going on in and around the open source project. New issues will be
released weekly on Mondays. We have a dedicated mailing list that will
deliver each issue directly to you e-mail, so you don't miss any!

If you have anything you'd like mentioned (a project, a discussion
somewhere, an upcoming event) then please get in touch.



-- 
Panagiotis Merakos 
LiveCode Software Developer

Everyone Can Create Apps 
___
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: breakpoint causes 3 second delay then exit to top

2020-07-27 Thread Bernard Devlin via use-livecode
Here's another data point for this oddity.

Once the IDE starts tripping out from breakpoints and I restart Livecode to
fix the problem, the behavior in which the breakpoints stop working has
"detached" from the object pointing to it.  I say "detached", as the object
still shows in the Inspector that it is pointing to the behavior-containing
control and choosing to edit the behavior script from the object's
Inspector opens up the relevant behavior in the Script Editor.  Breakpoints
work once again when I once more point the object's Inspector at the object
it knows contains the behavior script

Somewhere inside LC this connection is being lost.  At the moment the only
variable I've been able to isolate as a cause is: how many hours I've had
LC open working on this project.

On Fri, Jul 17, 2020 at 7:35 PM Bernard Devlin  wrote:

> I found later that the same thing was happening away from this code block,
> and with just a red breakpoint.
>
> As I don't restart my PC for weeks on end, I quit LC and restarted.  Both
> of these strange error situations disappeared.  Which suggests that it is
> some complex condition (either within my app or within the IDE) that leads
> to this situation.
>
>
___
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