Set the Behavior Not Working

2015-08-31 Thread Roger Guay
Can anyone tell me why this:

"set the behavior of image id 1727 to button id 1721 of stack 
“mySillyStack”"

does not work! i.e. it empties the behavior of image id 1727

Yet, I can paste:

"button id 1721 of stack “mySillyStack”"

into the behavior of image id 1727 and it works???



I’m using LC Community 6.6.5 on Mac OS X 10.10.5


Thanks,
Roger
___
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: Set the Behavior Not Working

2015-08-31 Thread Scott Rossi
Try setting the behavior to the long id of the button.

Otherwise, I believe you need to quote the button reference.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 8/31/15, 10:57 AM, "Roger Guay"  wrote:

>Can anyone tell me why this:
>
>   "set the behavior of image id 1727 to button id 1721 of stack
>³mySillyStack²"
>
>does not work! i.e. it empties the behavior of image id 1727
>
>Yet, I can paste:
>
>   "button id 1721 of stack ³mySillyStack²"
>
>into the behavior of image id 1727 and it works???
>
>
>
>I¹m using LC Community 6.6.5 on Mac OS X 10.10.5
>
>
>Thanks,
>Roger
>___
>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: Set the Behavior Not Working

2015-08-31 Thread Roger Guay
Thank you, Scott. The long id worked although I tried that earlier and it 
didn’t work? probably another error. 

Quoting the button reference did not work for me. Also tried bracketing and 
that did not work either.

Thanks again!

Roger





> On Aug 31, 2015, at 11:02 AM, Scott Rossi  wrote:
> 
> Try setting the behavior to the long id of the button.
> 
> Otherwise, I believe you need to quote the button reference.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
> 
> 
> 
> 
> On 8/31/15, 10:57 AM, "Roger Guay"  wrote:
> 
>> Can anyone tell me why this:
>> 
>>  "set the behavior of image id 1727 to button id 1721 of stack
>> ³mySillyStack²"
>> 
>> does not work! i.e. it empties the behavior of image id 1727
>> 
>> Yet, I can paste:
>> 
>>  "button id 1721 of stack ³mySillyStack²"
>> 
>> into the behavior of image id 1727 and it works???
>> 
>> 
>> 
>> I¹m using LC Community 6.6.5 on Mac OS X 10.10.5
>> 
>> 
>> Thanks,
>> Roger
>> ___
>> 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: Set the Behavior Not Working

2015-08-31 Thread Scott Rossi
I've always used the long id (or the behavior format itself) and have never had 
an issue assigning a behavior.

Regards,

Scott Rossi
Creative Director
Tactile Media UX/UI Design

> On Aug 31, 2015, at 11:12 AM, Roger Guay  wrote:
> 
> Thank you, Scott. The long id worked although I tried that earlier and it 
> didn’t work? probably another error. 
> 
> Quoting the button reference did not work for me. Also tried bracketing and 
> that did not work either.
> 
> Thanks again!
> 
> Roger
> 
> 
> 
> 
> 
>> On Aug 31, 2015, at 11:02 AM, Scott Rossi  wrote:
>> 
>> Try setting the behavior to the long id of the button.
>> 
>> Otherwise, I believe you need to quote the button reference.
>> 
>> Regards,
>> 
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX/UI Design
>> 
>> 
>> 
>> 
>>> On 8/31/15, 10:57 AM, "Roger Guay"  wrote:
>>> 
>>> Can anyone tell me why this:
>>> 
>>>"set the behavior of image id 1727 to button id 1721 of stack
>>> ³mySillyStack²"
>>> 
>>> does not work! i.e. it empties the behavior of image id 1727
>>> 
>>> Yet, I can paste:
>>> 
>>>"button id 1721 of stack ³mySillyStack²"
>>> 
>>> into the behavior of image id 1727 and it works???
>>> 
>>> 
>>> 
>>> I¹m using LC Community 6.6.5 on Mac OS X 10.10.5
>>> 
>>> 
>>> Thanks,
>>> Roger
>>> ___
>>> 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

___
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: Set the Behavior Not Working

2015-08-31 Thread Roger Guay
Thanks again, Scott.



> On Aug 31, 2015, at 11:38 AM, Scott Rossi  wrote:
> 
> I've always used the long id (or the behavior format itself) and have never 
> had an issue assigning a behavior.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media UX/UI Design
> 
>> On Aug 31, 2015, at 11:12 AM, Roger Guay  wrote:
>> 
>> Thank you, Scott. The long id worked although I tried that earlier and it 
>> didn’t work? probably another error. 
>> 
>> Quoting the button reference did not work for me. Also tried bracketing and 
>> that did not work either.
>> 
>> Thanks again!
>> 
>> Roger
>> 
>> 
>> 
>> 
>> 
>>> On Aug 31, 2015, at 11:02 AM, Scott Rossi  wrote:
>>> 
>>> Try setting the behavior to the long id of the button.
>>> 
>>> Otherwise, I believe you need to quote the button reference.
>>> 
>>> Regards,
>>> 
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, UX/UI Design
>>> 
>>> 
>>> 
>>> 
 On 8/31/15, 10:57 AM, "Roger Guay"  wrote:
 
 Can anyone tell me why this:
 
   "set the behavior of image id 1727 to button id 1721 of stack
 ³mySillyStack²"
 
 does not work! i.e. it empties the behavior of image id 1727
 
 Yet, I can paste:
 
   "button id 1721 of stack ³mySillyStack²"
 
 into the behavior of image id 1727 and it works???
 
 
 
 I¹m using LC Community 6.6.5 on Mac OS X 10.10.5
 
 
 Thanks,
 Roger
 ___
 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
> 
> ___
> 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: Set the Behavior Not Working

2015-08-31 Thread Richard Gaskin

Roger Guay wrote:


Can anyone tell me why this:

"set the behavior of image id 1727 to button id 1721 of stack 
“mySillyStack”"

does not work! i.e. it empties the behavior of image id 1727

Yet, I can paste:

"button id 1721 of stack “mySillyStack”"

into the behavior of image id 1727 and it works???


I don't know if this will clarify or confuse, but here goes:

Remember that in LiveCode objects are often containers, allowing us to 
do things like:


  put field 1 into field 2

This works with button contents, and image contents as well - try this 
in the Message Box:


  put image 1

You should see the binary image data in the Message Box, since that's 
the value contained in that control.


Buttons can contain data as well.  When the button is used as a menu 
this data is the list of menu items, but any button can have data stored 
in it - try this on a standard push button:


   put "Something" into btn 1; put btn 1

The "set the behavior" command expects a *reference* to an object, but 
usually can't understand the *contents* of an object.


So it may be helpful to think of your line as:

   set the behavior of image id 1727 to \
 (button id 1721 of stack “mySillyStack”)

...which obtains the text of the button, if any, and then attempts to 
set the image's behavior property to that value.  If we had used the 
button we created in the above example as our object, your script line 
would be interpreted as:


   set the behavior of image id 1727 to "Something"

...which of course can only confuse an otherwise-reasonably-smart 
LiveCode engine.


So as a general rule, having a habit of using the long id of an object 
will give you a reliable *reference* to an object whenever's a reference 
is needed, such as in the behavior property.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.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: Set the Behavior Not Working

2015-08-31 Thread Roger Guay
I think I understand your point here, Richard, except the association with your 
last sentence. I thought the long id would insure the use of a behavior of 
buttons outside the host stack. Put here is the thing:

I successfully used this:

"set the behavior of last image to the long id of button  
“myCoolBehavior" of card  “Main””   

 (card “main” is in myCoolSameStack stack)

When I use the message box for the behavior of that image, I get:

"button id 1721 of stack “myCoolSameStack””

why then can I not script:

“set the behavior of the image to button id 1721 of stack 
“myCoolSameStack"?


Thanks, 

Roger





> On Aug 31, 2015, at 12:49 PM, Richard Gaskin  
> wrote:
> 
> Remember that in LiveCode objects are often containers, allowing us to do 
> things like:
> 
>  put field 1 into field 2
> 
> This works with button contents, and image contents as well - try this in the 
> Message Box:
> 
>  put image 1
> 
> You should see the binary image data in the Message Box, since that's the 
> value contained in that control.
> 
> Buttons can contain data as well.  When the button is used as a menu this 
> data is the list of menu items, but any button can have data stored in it - 
> try this on a standard push button:
> 
>   put "Something" into btn 1; put btn 1
> 
> The "set the behavior" command expects a *reference* to an object, but 
> usually can't understand the *contents* of an object.
> 
> So it may be helpful to think of your line as:
> 
>   set the behavior of image id 1727 to \
> (button id 1721 of stack “mySillyStack”)
> 
> ...which obtains the text of the button, if any, and then attempts to set the 
> image's behavior property to that value.  If we had used the button we 
> created in the above example as our object, your script line would be 
> interpreted as:
> 
>   set the behavior of image id 1727 to "Something"
> 
> ...which of course can only confuse an otherwise-reasonably-smart LiveCode 
> engine.
> 
> So as a general rule, having a habit of using the long id of an object will 
> give you a reliable *reference* to an object whenever's a reference is 
> needed, such as in the behavior property.
> 
> -- 

___
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: Set the Behavior Not Working

2015-08-31 Thread Peter Haworth
The behavior is just a string of text so I think you need quotes around the
behavior:

set the behavior of the image to "button id 1721 of stack" & quote &
"myCoolGameStack" & quote

I set the behavior to the long id of the button, just because  I don;t have
write the clumsy code to put quotes around the stack name.

On Mon, Aug 31, 2015 at 3:02 PM Roger Guay  wrote:

> I think I understand your point here, Richard, except the association with
> your last sentence. I thought the long id would insure the use of a
> behavior of buttons outside the host stack. Put here is the thing:
>
> I successfully used this:
>
> "set the behavior of last image to the long id of button
> “myCoolBehavior" of card  “Main””
>
>  (card “main” is in myCoolSameStack stack)
>
> When I use the message box for the behavior of that image, I get:
>
> "button id 1721 of stack “myCoolSameStack””
>
> why then can I not script:
>
> “set the behavior of the image to button id 1721 of stack
> “myCoolSameStack"?
>
>
> Thanks,
>
> Roger
>
>
>
>
>
> > On Aug 31, 2015, at 12:49 PM, Richard Gaskin 
> wrote:
> >
> > Remember that in LiveCode objects are often containers, allowing us to
> do things like:
> >
> >  put field 1 into field 2
> >
> > This works with button contents, and image contents as well - try this
> in the Message Box:
> >
> >  put image 1
> >
> > You should see the binary image data in the Message Box, since that's
> the value contained in that control.
> >
> > Buttons can contain data as well.  When the button is used as a menu
> this data is the list of menu items, but any button can have data stored in
> it - try this on a standard push button:
> >
> >   put "Something" into btn 1; put btn 1
> >
> > The "set the behavior" command expects a *reference* to an object, but
> usually can't understand the *contents* of an object.
> >
> > So it may be helpful to think of your line as:
> >
> >   set the behavior of image id 1727 to \
> > (button id 1721 of stack “mySillyStack”)
> >
> > ...which obtains the text of the button, if any, and then attempts to
> set the image's behavior property to that value.  If we had used the button
> we created in the above example as our object, your script line would be
> interpreted as:
> >
> >   set the behavior of image id 1727 to "Something"
> >
> > ...which of course can only confuse an otherwise-reasonably-smart
> LiveCode engine.
> >
> > So as a general rule, having a habit of using the long id of an object
> will give you a reliable *reference* to an object whenever's a reference is
> needed, such as in the behavior property.
> >
> > --
>
> ___
> 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: Set the Behavior Not Working

2015-08-31 Thread Roger Guay
That works! Thanks, Peter.


> On Aug 31, 2015, at 3:08 PM, Peter Haworth  wrote:
> 
> The behavior is just a string of text so I think you need quotes around the
> behavior:
> 
> set the behavior of the image to "button id 1721 of stack" & quote &
> "myCoolGameStack" & quote
> 
> I set the behavior to the long id of the button, just because  I don;t have
> write the clumsy code to put quotes around the stack name.
> 
> On Mon, Aug 31, 2015 at 3:02 PM Roger Guay  wrote:
> 
>> I think I understand your point here, Richard, except the association with
>> your last sentence. I thought the long id would insure the use of a
>> behavior of buttons outside the host stack. Put here is the thing:
>> 
>> I successfully used this:
>> 
>>"set the behavior of last image to the long id of button
>> “myCoolBehavior" of card  “Main””
>> 
>> (card “main” is in myCoolSameStack stack)
>> 
>> When I use the message box for the behavior of that image, I get:
>> 
>>"button id 1721 of stack “myCoolSameStack””
>> 
>> why then can I not script:
>> 
>>“set the behavior of the image to button id 1721 of stack
>> “myCoolSameStack"?
>> 
>> 
>> Thanks,
>> 
>> Roger
>> 
>> 
>> 
>> 
>> 
>>> On Aug 31, 2015, at 12:49 PM, Richard Gaskin 
>> wrote:
>>> 
>>> Remember that in LiveCode objects are often containers, allowing us to
>> do things like:
>>> 
>>> put field 1 into field 2
>>> 
>>> This works with button contents, and image contents as well - try this
>> in the Message Box:
>>> 
>>> put image 1
>>> 
>>> You should see the binary image data in the Message Box, since that's
>> the value contained in that control.
>>> 
>>> Buttons can contain data as well.  When the button is used as a menu
>> this data is the list of menu items, but any button can have data stored in
>> it - try this on a standard push button:
>>> 
>>>  put "Something" into btn 1; put btn 1
>>> 
>>> The "set the behavior" command expects a *reference* to an object, but
>> usually can't understand the *contents* of an object.
>>> 
>>> So it may be helpful to think of your line as:
>>> 
>>>  set the behavior of image id 1727 to \
>>>(button id 1721 of stack “mySillyStack”)
>>> 
>>> ...which obtains the text of the button, if any, and then attempts to
>> set the image's behavior property to that value.  If we had used the button
>> we created in the above example as our object, your script line would be
>> interpreted as:
>>> 
>>>  set the behavior of image id 1727 to "Something"
>>> 
>>> ...which of course can only confuse an otherwise-reasonably-smart
>> LiveCode engine.
>>> 
>>> So as a general rule, having a habit of using the long id of an object
>> will give you a reliable *reference* to an object whenever's a reference is
>> needed, such as in the behavior property.
>>> 
>>> --
>> 
>> ___
>> 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: Set the Behavior Not Working

2015-08-31 Thread Richard Gaskin

Roger Guay wrote:
> I think I understand your point here, Richard, except the association
> with your last sentence. I thought the long id would insure the use
> of a behavior of buttons outside the host stack. Put here is the
> thing:
>
> I successfully used this:
>
>   "set the behavior of last image to the long id of button
>“myCoolBehavior" of card  “Main””
>
> (card “main” is in myCoolSameStack stack)
>
> When I use the message box for the behavior of that image, I get:
>
>   "button id 1721 of stack “myCoolSameStack””
>
> why then can I not script:
>
>“set the behavior of the image to button id 1721 of stack
>“myCoolSameStack"?

An object reference can be a string, or an expression that evaluates to 
a string.  For example these put the same string into the variable tVar:


  put the long id of btn id 1721 of stack "SomeStack" into tVar
  put "btn id 1721 of stack "& "SomeStack"  into tVar

The difference between that second expression and the example you gave 
above that didn't work is that when using the "set" command the tokens 
following it will be evaluated.


When quoted, or prepended with "the long id of ", the result of that 
expression is a string, which is then used by the "set" command.


But without quotes the expression is evaluated, which results in "set" 
using the contents of the button.


This ambiguity in xTalk was handy in allowing us to do things like this:

  put fld 1 + fld 2 into fld 3

...but comes at a cost to ambiguity, since you're not the first person 
I've come across who expects an object reference to be treated as an 
object reference rather than as a series of tokens to be evaluated.


Lately I tend to prefer property-driven syntax for its clarity:

  set the text of fld 3 to the text of fld 1 + the text of fld 2

Much more cumbersome to write, but avoids the whole question of whether 
I'm referring to a property of the object or the object itself.


This "explanation" may only add to the confusion, but there's the rub: 
for all the seeming simplicity of xTalk, there are more than a few such 
ambiguities, which can make it harder to learn.  And I believe this one 
is among the ambiguities LiveCode Builder addresses.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.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: Set the Behavior Not Working

2015-08-31 Thread Roger Guay
Thanks for taking so much time on this, Richard. I get it now, but here is 
another example where the dictionary could do better!




> On Aug 31, 2015, at 4:37 PM, Richard Gaskin  
> wrote:
> 
> An object reference can be a string, or an expression that evaluates to a 
> string.  For example these put the same string into the variable tVar:
> 
>  put the long id of btn id 1721 of stack "SomeStack" into tVar
>  put "btn id 1721 of stack "& "SomeStack"  into tVar
> 
> The difference between that second expression and the example you gave above 
> that didn't work is that when using the "set" command the tokens following it 
> will be evaluated.
> 
> When quoted, or prepended with "the long id of ", the result of that 
> expression is a string, which is then used by the "set" command.
> 
> But without quotes the expression is evaluated, which results in "set" using 
> the contents of the button.
> 
> This ambiguity in xTalk was handy in allowing us to do things like this:
> 
>  put fld 1 + fld 2 into fld 3
> 
> ...but comes at a cost to ambiguity, since you're not the first person I've 
> come across who expects an object reference to be treated as an object 
> reference rather than as a series of tokens to be evaluated.
> 
> Lately I tend to prefer property-driven syntax for its clarity:
> 
>  set the text of fld 3 to the text of fld 1 + the text of fld 2
> 
> Much more cumbersome to write, but avoids the whole question of whether I'm 
> referring to a property of the object or the object itself.
> 
> This "explanation" may only add to the confusion, but there's the rub: for 
> all the seeming simplicity of xTalk, there are more than a few such 
> ambiguities, which can make it harder to learn.  And I believe this one is 
> among the ambiguities LiveCode Builder addresses.

___
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