Grouped Buttons & clickText - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Grouped Buttons & clickText - Solved

Post by DR White » Mon Aug 26, 2013 11:38 pm

I have five buttons in a group.
What is wrong with the code below that keeps the clickText from returning the text from the button label that I clicked?

if the clickText contains "Easy" then Correct

Does it work with labels?
How can I make this work?

Thanks So Much,

DR White
Last edited by DR White on Thu Sep 19, 2013 2:57 am, edited 1 time in total.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Mon Aug 26, 2013 11:48 pm

Ohhh... a button has a word attached but you are clicking on the button not the word.
on mouseUp
if the label of me contains "Easy" then put "Correct"
end mousingAround

Now you could add a custom property to the button because I don't think you want to show the answer?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:01 am

Simon,

Your suggestion seemed logical, but it did not work.

Thanks,

David

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 12:05 am

Ahh, you have to have a label assigned,
Check the property inspector for the button.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 12:09 am

Got some more for you.
set the name of the button to "Correct" and the Label of the button to "Answer 1" -- this isn't code
Then it wont show as Correct.
if the short name of me = "Correct" then put "Correct" -- this is code :)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:12 am

Simon,

I have the label set as "easy" of the one the buttons in the group, but the label of me comes back empty

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:15 am

Simon,

When I use the short name, it just returns the group ID

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 12:23 am

Works here???

Simon
Attachments
meName.zip
CL 6.0
(555 Bytes) Downloaded 194 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:35 am

Simon,

When you say "label assigned" exactly how do you mean?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 12:39 am

See the above attached stack.
(was an edit)

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:52 am

Simon,

Show me your code that returns the button label, when you click on it.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 12:53 am

ummm...
it's in the buttons? No?
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

DR White
Posts: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Grouped Buttons & clickText

Post by DR White » Tue Aug 27, 2013 12:56 am

Simon,

Please see my first post.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Grouped Buttons & clickText

Post by Simon » Tue Aug 27, 2013 1:01 am

Well I guess I completely misunderstood your question.
Could you elaborate?

If the difference is just name or lable then it's an easy change.
"put the label of me"


Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9669
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Grouped Buttons & clickText

Post by dunbarx » Tue Aug 27, 2013 1:30 am

The clickText only returns a value in a control that contains actual text. Like fields. The properties of a button are not pertinent, even though those properties devolve to text, like the label. They live in a different world.

What you need to do is change to something like:

on mouseUp
answer the label of me
end mouseUp

Or you can use a handler higher up in the hierarchy that puts the label of the target.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”