LiveCode Button Click Not Updating Label

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
samantha23
Posts: 1
Joined: Thu May 23, 2024 10:16 am
Contact:

LiveCode Button Click Not Updating Label

Post by samantha23 » Thu May 23, 2024 10:21 am

I'm building a mobile app prototype in LiveCode to help users track their fitness goals. I've created a stack with a button and a label. When the button is clicked, the label should display the current date. However, when I run the app on my iPhone simulator, clicking the button doesn't update the label with the date.

Code: Select all

on mouseUp
  put the short date into myLabelText
end mouseUp
I've double-checked the code and it seems correct. Is there anything obvious I might be missing that's preventing the label from updating?
I'm new to LiveCode mobile development. Could there be any platform-specific considerations that might be causing this issue?
Has anyone else encountered a similar problem with buttons and labels not interacting as expected? If so, what was the solution?

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: LiveCode Button Click Not Updating Label

Post by Klaus » Thu May 23, 2024 10:32 am

Hi samantha33,

welcome to the forum!

Your script will put the short date into a variable named: myLabelText
But you want to set the property LABEL of that button:

Code: Select all

on mouseUp
  set the LABEL of me to the short date
end mouseUp
Best

Klaus

P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting.

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

Re: LiveCode Button Click Not Updating Label

Post by dunbarx » Thu May 23, 2024 3:38 pm

What Klaus said about the fact that you loaded a variable as opposed to some sort of control.

When you say 'myLabelText", do you mean a label field? That is, not a button at all, but a field? If so, you would:

Code: Select all

put the short date into field "yourFieldHere"
We will get together on the proper way to communicate; it just takes a little back and forth.

Craig

Post Reply

Return to “Talking LiveCode”