Challenge: how to set the text of a field

David Bovill david at vaudevillecourt.tv
Fri Mar 29 12:54:23 EDT 2013


Thanks Scott - yes you can do that - so for instance:

getprop title_Text [cardNum]
>     return the text of fld 1 of group "Test" of card cardNum
> end title_Text
>
> setprop title_Text [cardNum] someText
>    set the text of fld 1 of group "Test" of card cardNum to someText
> end title_Text
>

works - but is not good enough. I want to use the syntax "the title_Text of
group 1 of card 3" - is anyone able to hack this any better - if not I
suggest this makes it impossible to script basic behaviors for groups
designed to be placed on multiple cards?

On 29 March 2013 11:59, Scott Rossi <scott at tactilemedia.com> wrote:

> This problem is based on the same issue that Pete Haworth ran into:
> references to controls within groups placed on multiple cards resolve to
> the current card.
>
> Not sure if this would be an option for you, but you could use commands in
> the behavior instead of set/getProp and include the card number as a
> parameter (argument?), since you'll likely know the card of the group you
> intend to modify.
>
> command setMyText pCardNum, pFieldName, pValue
>    put the id of me into theID
>    set text of fld pFieldName of grp id theID of cd pCardNum to pValue
> end setMyText
>
> command getMyText pCardNum, pFieldName
>    put the id of me into theID
>    return the text of fld pFieldName of grp id theID of cd pCardNum
> end getMyText
>
> But when you get down to it, there's no need for this script to be a
> behavior.
>
>
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 3/29/13 2:08 AM, "David Bovill" <david at architex.tv> wrote:
>
> >OK - a very basic challenge for all you LIveCode wizz kids out there :)
> >How
> >do you set the text of a field. The twist is you need to do it for a group
> >which has been placed on multiple card, so there is the text on card 1 and
> >this is different from the text on card 2. The difficulty is that you want
> >to use a behavior of a group, so that you can refer to the text of the
> >"Title" field (there are two fields in the group - one called "Title" and
> >one called "Body").
> >
> >The problem is based on the fact that while you can get "the text of fld
> >"Title" of card 2" - the title_Text of group "Title" of card 2 does not
> >work - it returns the text of the "Title" field of the current card. So
> >how
> >do you do this?
> >
> >Here are the sample handlers (that don't work):
> >
> >getprop title_Text
> >>    return the text of fld "Title" of me
> >> end title_Text
> >>
> >> setprop title_Text someText
> >>    set the text of fld "Title" of me to someText
> >> end title_Text
> >>
> >
> >To make it easier to test you can use a setprop (or any handler placed in
> >the stack script). The only way I can do this is by a horrible hack - is
> >anyone up to the challenge?
> >_______________________________________________
> >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
> >
>
>
>
> _______________________________________________
> 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