Buttons Names to show in a field

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Buttons Names to show in a field

Post by bsouthuk » Sun Jan 30, 2011 6:59 pm

Hi I want to be able to display the names of all buttons within a group in a field. I am trying with the following code:

Code: Select all


put the num of buttons of grp "CompanyType" of group "Porrima" of  card 26 into num_fields
lock screen
repeat with i = 1 to num_fields
put the label of button i of grp "CompanyType" of group "Porrima" of card 26 into fld "test"
end repeat
unlock screen

However, only the name of the last button displays in the field. Obviously it appears that each time it repeats, the name of the following button is over writing the name of the previous one. Can anyone spot the problem in my code?

Thanks guys!

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Buttons Names to show in a field

Post by bangkok » Sun Jan 30, 2011 7:16 pm

That should do it :

put the label of button i of grp "CompanyType" of group "Porrima" of card 26 & CR after fld "test"

A carriage return to make a new line, and "after" rather then "into" (otherwise the next line replaces the previous)

bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

Re: Buttons Names to show in a field

Post by bsouthuk » Sun Jan 30, 2011 11:09 pm

That's great thank you for your help!

Post Reply