Android Question Determine whether user raised event or not

swabygw

Active Member
Licensed User
Longtime User
I have a user form with a SeekBar on it that the user can change which will raise the _ValueChanged event. However, I'm also loading in data from a database occasionally and the loaded data can also change the value of the Seekbar. But, I want the commands in the _ValueChanged event to fire only if the user changes the value, not the data. Is it possible to differentiate between the two events? Here's some sample pseudocode:

Code: Copy
Sub MySeekBar_ValueChanged
  ...do something...but only if the user changes the value, not the loaded data...
End Sub

* I just realized that the scenario I proposed wasn't accurate - rewriting it.
 
Last edited:
Thanks for the response - I had to rewrite the question. The problem is that the event always fires regardless of who or what triggered the event. I'm wondering if there's a way to know if the user or the data triggered the event.
 
Upvote 0
Well.. I am far from an expert...

Can use pass a flag to your event to tell it who called it?
 
Upvote 0
That's exactly what I'd like to do, but, from what I understand, the procedure is declared like this:

Code: Copy
Sub MySeekBar_ValueChanged (index As Float, value As Object)

Where the index and value are set automatically by the change, and I don't see a way to include another parameter. Is there a way to include another parameter?
 
Upvote 0
Please post your code so it can be looked at. These little snippets are hard to determine what you are doing.
 
Upvote 0
Here's a copy of the event:
Code: Copy
Sub MySeekBar_ValueChanged (index As Float, value As Object)
  CallSub2(Starter, "ReloadData", False)
End Sub
ReloadData is too long to post, but the general idea looks like this:
Code: Copy
Sub ReloadData
  MySeekBar.Value = ValueFromDatabase
End Sub

The idea is that the ReloadData should only be called when a user changes the value of the SeekBar. But, sometimes, when the data is loaded, it can change the value of the SeekBar, too, which can cause another fire of ReloadData...and possibly an endless loop.
 
Upvote 0
I found the answer. The SeekBar does, indeed, have a UserChanged boolean parameter. I didn't see it because I've been using a CustomSlideBar library which eliminated it. I modified the library slightly to pass the value and it works.
 
Upvote 0
Back
Top