Seekbar Userchange Questions

tcgoh

Active Member
Licensed User
Longtime User
Hi,

I have search the forum, but could not get a simple code for the above. Could someone help?

I am trying the get the value of the seekbar to be displayed in a label box when the userchange the seekbar position.

Code: Copy
Sub seekbar1_Valuechange ( Value As Int, userchange As Boolean)
   If userchange Then
      label.Text = Value
   End If

End Sub


?? thanks
 
What's the problem, your code is right.
You just need to make sure that the Label you are refering to, is in a layout or defined in the code.

Best regards.

Hi Klaus,


Thanks Klaus for the quick reply.
But I'm NOT getting any "value" in my label box, here is my code
Code: Copy
Sub Globals
   Dim lblto As Label
   Dim seekbar1 As SeekBar
End Sub

Sub Activity_Create(FirstTime As Boolean)
   lblto.Initialize("lblto")
   Activity.LoadLayout("Main")
   lblto.SetLayout(5%x,75%y,15%x,7%y)
      
   seekbar1.Max = 100
   
End Sub

Sub seekbar1_Valuechange ( Value As Int, userchange As Boolean)
   If userchange Then
      lblto.Text = Value
   End If
End Sub

What am I missing?:BangHead:
 
Upvote 0
If lblto is already defined in the layout file you must remove this line, because lblto is alraed initialized when the layout file is loaded :
Code: Copy
lblto.Initialize("lblto")
Best regards.


It is still NOT working??

Regards
 
Upvote 0
The signature for your event sub is ALSO wrong.
The better way to debug these problems is to add a log when entering or exiting an event so you know that is actually fires.

Code: Copy
ValueChanged (Value As Int, UserChanged As Boolean)

OK that did it. Great thanks.

:sign0098:
 
Upvote 0

Similar Threads

  • Question Question
Android Question UDP _seekbar
Replies
5
Views
3K
  • Question Question
Android Question seekbar question
Replies
2
Views
2K
  • Question Question
Android Question seekbar question
Replies
2
Views
2K
  • Article Article
Android Code Snippet Photo filters Seekbar
Replies
3
Views
7K
Back
Top