Label - display parameters & display on hover
-
Hi all, I'm wanting to have labels display parameters (for example, reverb wet level percentage) how does one go about this?
Is there also a way to have the label change on hover? For example if I have one label displaying the parameter name, when its hovered over, the parameter value label appears?
-
@paper_lung said in Label - display parameters & display on hover:
Hi all, I'm wanting to have labels display parameters (for example, reverb wet level percentage) how does one go about this?
myLabel.set("text", "some string here");
Is there also a way to have the label change on hover? For example if I have one label displaying the parameter name, when its hovered over, the parameter value label appears?
use local LAF
-
@Lindon Thanks! What would be the easiest way to just set the label to go from 0-100?
-
@paper_lung said in Label - display parameters & display on hover:
@Lindon Thanks! What would be the easiest way to just set the label to go from 0-100?
Well assuming your slider is set to NormalisedPercentage and min = 0 and max = 1, then in the slider callback:
myLabel.set("text", (mySlider.getValue()*100) + "%"));
HiseSnippet 915.3ocsVEtaaTDDdWmrgZCshhP76SQJRWfPjcoTPBgZHNIHq1jZgSi3eUquat3UducM6tWIFTk3QimDDOB7F.yt2YeWnF2VKg+QTlcluY9lwe6rdnQm.Vq1Pnsub9LfP+.1n4J2j9S3BEYvID58XmysNvDUdzwymwsVHkPoa889Cns2lD97WO9XtjqRf5iHjqzhD3ohbgq9zgG8DgTdFOEtTj2H5GdzfDspuVpKP9rEqKYFOYJ+Z3BtOrVLBcmSSENsYji6.KFyw5z4iln+YUY7WIrhwRvaziLBST4wj9SDxzgK5UKgP2dXcmuUYm+wryEohkmWOA9vfinZDMmAzVqiR8dGnDsAk1tjR2mMJwHl4p834y6yFnvuPx33ntIUJikz5Onr9ZLBk6vb9T3LCZrDQ7i518fH7O6+Mc5fiaqK5kbSzS4iAYunuMZAxqAWec9LsBMh2sz8tHlZHOQoG+eiH30C.+HTRgBhxJTINgVEoUAudfFsLNYApCv7JKf867qcZWVwCs.lKGbia2CNm6lbnQWnRiiC38U7JOf382+S6gczms6d9J9JrnqkT9rVU79bobLpxhuMmvrzfsWncvyTwAd04Uch92txxVoupbIAyJc6E+l0ALVUjOFLMmJ9.Q0wskb671I4RJGIMBTqFnDtmMCprOSKS8RI+++5BTR0L0KUqXHFpKHTuWkPcjTjBFh.Sx6wBCTRf7MWIPd9fS3N9hzfYDqxLv3D9lgdB7RbkQo9uM6DvN0omg29W90Hg14MVzaVVveWdz7lFV2b+nYmPfjbQZpDFpsB+nulk+4isEYYha7yh8HYBYt0gkZPNtMhP+H1ysPTJjwKjtH6TbOAJvmBoWpCqox0oXTeB6BsImKE+BjNDLIH08nIMZDVYib2pFIn4C8wcXk5+lMx0MZje6mNxeo.kBrt6gaTesMG3NKcZgj6t8hL+F6JG99s41C+FBENGl2bi96v1stqc61aKEuOanvkLY0br0J3HJi9+fiUuIbW1oYYPhqlfayN6G2zG.dCk+GzENg5ZbOmwq7XWTjOBeJLAvpqTfDSNi1xeQrztq21OAFApzfweiepb1yaSqb1agSRNOwneQR40W+qN2IbBxIU3Q113q8nczx6sLV2C65umHdQRhu8+bb2vpw7fM.yWrAXd3Ff4K2.LOZCv7Ua.ludsX7+1iuqvoyKuNfGL7zv9SJ8TEGUVAUH4evxK0pg
-
@Lindon said in Label - display parameters & display on hover:
use local LAF
I don't think you could use LAF for this. You'd need to use a broadcaster to detect when the mouse is over the control and then update the label from the broadcaster's listener callback function.
However this is complicated just to display some text.
A better solution is to not use labels at all and use only local look and feel.
This knob for example is entirely LAF, including the "label".
-
@d-healey I don't suppose you have any examples of that knob I could check out? That's exactly the kind of thing I'm hoping to achieve. I've managed to get a LAF knob working, but struggling with the text.
-
@d-healey You can draw the text in local LAF directly using obj.value if obj.hover == true.
If you want it to stay around for a while after you've hovered it... then you need timers and it gets more complex. Just a label change on hover is very simple in LLAF.
if (obj.hover) var textToShow = obj.value; else var textToShow = obj.text;
Use textToShow for g.drawAlignedText.
You can call Console.print(trace(obj) in the LLAF and it will print all the properties of the obj object, so you can see all that you can use. There's one with the value including the suffix as well (suffix being the component property).
Sometimes numbers can be a bit weird due to floating point error ( I assume) so you can use Engine.doubleToString() to trim the number of shown decimals for obj.value.
-
@aaronventure said in Label - display parameters & display on hover:
You can draw the text in local LAF directly using obj.value if obj.hover == true.
Yep this is all I'm doing
-
@aaronventure just coming back to this, thanks a lot for the advice! Can you explain what you mean with 'Use textToShow for g.drawAlignedText.'
Are you using the code you showed in the LLAF slider function?
-
@paper_lung it's a variable that contains either the value or the text property (likely the control's full name with proper capitalization and spaces)
you then call g.drawAlignedText and pass the textToShow variable. As the variable changes based on the boolean value of the hover property, so too will the drawn text.
-
@aaronventure Thanks, that makes sense. Are you doing this within the Slider LLAF or are you adding a new function?
-
@paper_lung yes it's the LAF/paint routine