Today we thought it would be nice to have expressions in a a textfield (slider input-field for instance) so the user can use some simple math to enter a value.
So i looked around Juce and found your wonderful Expression class.
Just wanted to say thanx! :wink:
Jules, did you write that all yourself btw, seems like some hardcore parsing.

Thanks, glad that you appreciate it!

Writing a parser isn’t as hard as it looks, and is probably one of those things that every programmer should do at least once. (Took me a few attempts before I hit on the right evaluation algorithm though, as I needed the class to be able to handle scoped variable names, and that makes it really quite tricky!)

Well if i find a good reason to write my own parser i’ll give it a try.
Anyway, any reason why components like the Slider for instance don’t use the Expression class when trying to convert the value the user entered.
I just overrode (is that proper english, sounds sill) Slider::getValueFromText and pass the text entered to the Expression to evaluate it. Simple enough, but because it’s such a powerful feature it could be easily set to be the default behaviour for these kind of controls.

I guess it could use expressions for that, I just never really expected anyone to type that kind of thing into the box - maybe your users are a bit more mathematically minded!

We thought of this feature because you can do the same in OSX’s spotlight. You can use it to search but also todo quick calculations.
press CMD+Space and start typing your expression, it’s a powerful feature. Once you know it’s there you’ll use it all the time.