Page 1 of 1

LiveCode Button Click Not Updating Label

Posted: Thu May 23, 2024 10:21 am
by samantha23
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?

Re: LiveCode Button Click Not Updating Label

Posted: Thu May 23, 2024 10:32 am
by Klaus
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.

Re: LiveCode Button Click Not Updating Label

Posted: Thu May 23, 2024 3:38 pm
by dunbarx
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