Re: Learned my lesson

2020-04-17 Thread Mark Wieder via use-livecode

On 4/17/20 6:53 PM, Phil Davis via use-livecode wrote:
I feel your pain! I switched to using "of me" or "of the owner of me" 
whenever possible which works very well in many/most cases, but 
sometimes it just isn't enough.


"the mainstack of this stack" always work as well.
Almost always.
Don't try it in a frontscript, though.

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


Re: Learned my lesson

2020-04-17 Thread Bob Sneidar via use-livecode
I’ve also discovered the childControlIDs and the childControlNames. These list 
the direct children of a group. The controlNames and controlIDs list EVERY 
object on a card whether grouped or not. 

The latter becomes especially handy of you preface your object names with some 
kind of type identifier. For example fld, btn, menu, grp, dg. Then you can for 
example filter the controlNames with “fld*” and presto! a list of all the 
fields on your card! 

In my stack scripts now I always use me when referring to the stack. 

Bob S


> On Apr 17, 2020, at 6:53 PM, Phil Davis via use-livecode 
>  wrote:
> 
> I feel your pain! I switched to using "of me" or "of the owner of me" 
> whenever possible which works very well in many/most cases, but sometimes it 
> just isn't enough.
> 
> Phil Davis

___
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: Learned my lesson

2020-04-17 Thread Phil Davis via use-livecode
I feel your pain! I switched to using "of me" or "of the owner of me" 
whenever possible which works very well in many/most cases, but 
sometimes it just isn't enough.


Phil Davis


On 4/17/20 6:41 PM, Bob Sneidar via use-livecode wrote:

I just spent 2 hours purging the detestable “this stack” from my entire list of 
projects. If you use substacks, if you hide and show stacks, this stack simply 
unreliable. Instead put this at the head of every script that needs to know 
what the parent stack is:

put getParentStack(the long id of me) into tParentStack

and have this in a library or active script somewhere:

function getParentCard pObjectID
put offset("card id", pObjectID) into tStartChar
put char tStartChar to -1 of pObjectID into tCardID
return tCardID
end getParentCard

function getParentStack pObjectID
put offset("stack ", pObjectID) into tStartChar
put char tStartChar to -1 of pObjectID into tParentStack
return tParentStack
end getParentStack

Now you will know ABSOLUTELY which stack you are in from any object on any 
card. And no, I’m not senile (much yet) I know I already posted this some time 
ago.

Bob S

___
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
503-307-4363


___
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


Learned my lesson

2020-04-17 Thread Bob Sneidar via use-livecode
I just spent 2 hours purging the detestable “this stack” from my entire list of 
projects. If you use substacks, if you hide and show stacks, this stack simply 
unreliable. Instead put this at the head of every script that needs to know 
what the parent stack is:

put getParentStack(the long id of me) into tParentStack

and have this in a library or active script somewhere:

function getParentCard pObjectID
   put offset("card id", pObjectID) into tStartChar
   put char tStartChar to -1 of pObjectID into tCardID
   return tCardID
end getParentCard

function getParentStack pObjectID
   put offset("stack ", pObjectID) into tStartChar
   put char tStartChar to -1 of pObjectID into tParentStack
   return tParentStack
end getParentStack

Now you will know ABSOLUTELY which stack you are in from any object on any 
card. And no, I’m not senile (much yet) I know I already posted this some time 
ago. 

Bob S

___
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