Android Question how: Automatically run a function after view updates?

terminator2

Member
Licensed User
Longtime User
I have a label that updates after one of several buttons are clicked. After the label is updated I would like to automatically run a function that will clean up the label text. For example if the label is updated to "3.00" I would like to fire a function that reformats it to just "3" or trims " hello " to just "hello".

I know I could do this when the button is clicked but I would have code this into every button push instead of just once after any button updated the field.

Thanks,
Jim
 

DonManfred

Expert
Licensed User
Longtime User
call the "new sub" inside your button click event... Update the label call the sub
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
I think what you're asking is if there is a function that detects when the Label.Text property has changed, and in short the answer is no. You'll need to determine a work around that suits your needs. Likely one sub that you pass the text to, it "cleans" it up, then sets the label.text property
 
Upvote 0

terminator2

Member
Licensed User
Longtime User
call the "new sub" inside your button click event... Update the label call the sub
Thanks Don. I was trying to avoid putting the update label code on each and every button click object. If the label.text update generated some event that I could key on... I would only have to put the update the code there once.

Sorry if my terminology is not B4Aish. I'm used to javascript.
 
Upvote 0

terminator2

Member
Licensed User
Longtime User
I think what you're asking is if there is a function that detects when the Label.Text property has changed, and in short the answer is no. You'll need to determine a work around that suits your needs. Likely one sub that you pass the text to, it "cleans" it up, then sets the label.text property
OK Thanks. That's what I'll do.
 
Upvote 0
Top