Bad text...

Björnke von Gierke bvg at mac.com
Sun Jan 9 07:48:50 EST 2011


i can replicate this even when using normal handlers, but only as long as "sharedtext" is false (for example it does work correctly with the 'default' label fields of the ide). I filed a bug report:
http://quality.runrev.com/qacenter/show_bug.cgi?id=9286


--stacks script
on bText
  return the text of the target
end bText

on gText
  put the long id of the target into targetObject
  return the text of targetObject
end gText

send gtext to field 1 of card 1; put the result
send btext to field 1 of card 1; put the result


On 9 Jan 2011, at 10:51, David Bovill wrote:

> On 9 January 2011 01:08, Mark Wieder <mwieder at ahsoftware.net> wrote:
> 
>> 
>>>> getprop bad_Text
>>>>   return the text of the target
>>>> end bad_Text
>>>> 
>>>> getprop good_Text
>>>>   put the long id of the target into targetObject
>>>>   return the text of targetObject
>>>> end good_Text
>>>> 
>> 
>> I get the same results with either here. What are you seeing?
>> 
> 
> It's actually pretty annoying - or interesting depending what mood you are
> in :)
> 
> 
> Very basic:
> 
>   - Create a stack with 2 cards
>   - Create a field on the second card with the text "Hello World!"
>   - Set the stack script to:
> 
> getprop bad_Text
>>   return the text of the target
>> end bad_Text
>> 
>> getprop good_Text
>>   put the long id of the target into targetObject
>>   return the text of targetObject
>> end good_Text
> 
> 
> On the first card try "put the good_Text of fld 1 of cd 2", which works as
> expected, but  "put the bad_Text of fld 1 of cd 2" returns empty! It gets
> even more complicated if you try to get "the properties of fld 1 of cd 2" -
> where the "long id" trick no longer works.
> 
> This is a basic feature of the way "the target" works and not to do with
> using getprop / setprops. I'd call it a serious bug - as this is not how
> "the target" should work, even worse is that the simple line "get the
> properties of fld 2 of cd 1" returns the wrong result whichever way you
> construct it - the only way to get the real properties is a hack like the
> following:
> 
> put the properties of fld 1 of cd 2 into propArray
> put the htmltext of fld 1 of cd 2 into propArray ["htmlText"]
> 
> Though in real world scripts you need to check the target is a field, and
> add a similar hack for the "hilite"
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list