J jmoeller Member Licensed User Longtime User Jan 2, 2017 #1 I am developing an app for low literacy users. I have three buttons on the screen which I want read to the user. I want to show which button corresponds to the instructions, so I want to turn the button red while the corresponding audio plays. Here is my code... Code: AgreeButton.Color = Colors.Red 'Msgbox("turn it red", "Notification") sp.Load(File.DirAssets,"agree.mp3") sp.Play AgreeButton.Color = Colors.Gray As listed, the code doesn't change the color of the button. However, if I uncomment the "Msgbox" line, it changes the button color to red. Any idea what is happening here?
I am developing an app for low literacy users. I have three buttons on the screen which I want read to the user. I want to show which button corresponds to the instructions, so I want to turn the button red while the corresponding audio plays. Here is my code... Code: AgreeButton.Color = Colors.Red 'Msgbox("turn it red", "Notification") sp.Load(File.DirAssets,"agree.mp3") sp.Play AgreeButton.Color = Colors.Gray As listed, the code doesn't change the color of the button. However, if I uncomment the "Msgbox" line, it changes the button color to red. Any idea what is happening here?
Cableguy Expert Licensed User Longtime User Jan 2, 2017 #2 the notification is giving the underlying SO the time needed for the change to be noticeable! you are change the color of the button in a rapid sequence, which, without the message notification its takes the last color change almost immediatly Upvote 0
the notification is giving the underlying SO the time needed for the change to be noticeable! you are change the color of the button in a rapid sequence, which, without the message notification its takes the last color change almost immediatly
Erel B4X founder Staff member Licensed User Longtime User Jan 3, 2017 #3 Use CallSubPlus to set the color back to gray after 500ms. Code: AgreeButton.Color = Colors.Red sp.Load(...) sp.Play csu.CallSubPlus2(Me, "Reset_Color", 500, Array (AgreeButton)) End Sub Sub Reset_Color (Args() As Object) Dim b As Button = Args(0) b.Color = Colors.Gray End Sub Upvote 0
Use CallSubPlus to set the color back to gray after 500ms. Code: AgreeButton.Color = Colors.Red sp.Load(...) sp.Play csu.CallSubPlus2(Me, "Reset_Color", 500, Array (AgreeButton)) End Sub Sub Reset_Color (Args() As Object) Dim b As Button = Args(0) b.Color = Colors.Gray End Sub