Vote count:
0
First consider this situation. You have a slider and a text field, both bound to a class called AppController, to a property called opacity. When you change the slider, the text field shows the slider value and the opacity changes on the class. When you change the value inside the text field, the slider changes position and the opacity value changes on the class. This is ok.
Now consider this situation, where I want to do more or less the same thing...
I have developed a text field based class called ScrubberLabel. This special label will contain text and is to be placed side to side with another text field containing a float value. Something like used in Photoshop. This works like this. When the user puts the mouse over it and drags left/right the value on the other text field decreases/increases. See pic.
On this picture, dragging over the opacity label will change the values of the opacity textfield on the right.
My scrubber output gives me delta values, I mean, the difference in pixels positive or negative, for example, if the user drags 10 pixels to the right it gives me 10... 20 pixels to the left, it gives me -20. This delta is used to calculate how much the right label will increase or decrease.
I have to bind the whole thing to a property called opacity on AppController. Biding the numeric text field is easy, but how do I bind this scrubber, so when I scrub it, it calculates the delta, then the new numeric value of that property?
Is it possible to bind a method output to a property?
Aucun commentaire:
Enregistrer un commentaire