How to generate a ValueChanged without changing value


#1

I’m listening to a Value that contains a filepath in order to load the contents of a file. I’d like to reload the file sometimes, but setting the value to the same filepath does not cause a ValueChanged event.

Any way to cause a ValueChanged without having to send some value like an empty string first?


#2

use a timer to increment another Value, which causes the valueListeners to check in on the filepath. sort of a “Hey, go check that filepath now” timer.


#3

What about this?

myValue.getValueSource().sendChangeMessage(true);


#4

Thanks masshacker, that seems a reasonable workaround. The one problem is now I get two requests to load the file. First one when the actual value changes, and the second when I execute the sendChangeMessage. But for reloading the same file, it works.

What we need is way for the Value to send the change message on any assignment.

I can add in a few lines of code to check for a new assignment, but was hoping for a sweet juce method.