change label name

Alex Tweedly alex at tweedly.net
Thu Feb 17 17:37:08 CST 2005


Bob Hartley wrote:

> Hi All.
> I have a button that copies a label from one stack to another stack.
>
> the code changes the name OK but I want to change the visible text in 
> the label.
>
> the code is
> on mouseUp
>   global tFileName
>   copy field "LabelName" of stack "Armbase" to card 1 of stack tFileName
>   set the name of field LabelName of stack tFileName to field 
> LabelNewName of stack "Armbase"
>   --the above is OK and copies the label and changes its name to the 
> contents of a field
>   set the label of field LabelName of stack tFileName to field 
> LabelNewName of stack "Armbase"
> --this one above generates an error
> end mouseUp
>
> I tried using the words contents and name etc in thelast line but 
> without any luck.
>
> Any ideas. I'm sure this is simple.

Two possibilities / suggestions:

1. did the line
       set the name of field LabelName of stack tFileName to field 
LabelNewName of stack "Armbase"
change the name, such that the field can no longer be identified as    
field LabelName

(and, btw, I'd be strict about putting quotes around LabelName ---- and 
even suggest setting explicit variables)

2. fields don't (AFAIK) have a "label" property - it should be
     set the text of ....


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005



More information about the use-livecode mailing list