HISE Logo Forum
    • Categories
    • Register
    • Login

    Label - display parameters & display on hover

    Scheduled Pinned Locked Moved General Questions
    12 Posts 4 Posters 468 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      paper_lung @Lindon
      last edited by

      @Lindon Thanks! What would be the easiest way to just set the label to go from 0-100?

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @paper_lung
        last edited by Lindon

        @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
        

        HISE Development for hire.
        www.channelrobot.com

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @Lindon
          last edited by

          @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".

          Peek 2023-11-13 11-36.gif

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          P A 2 Replies Last reply Reply Quote 2
          • P
            paper_lung @d.healey
            last edited by

            @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.

            1 Reply Last reply Reply Quote 1
            • A
              aaronventure @d.healey
              last edited by aaronventure

              @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.

              d.healeyD P 2 Replies Last reply Reply Quote 1
              • d.healeyD
                d.healey @aaronventure
                last edited by

                @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

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 0
                • P
                  paper_lung @aaronventure
                  last edited by

                  @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?

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    aaronventure @paper_lung
                    last edited by

                    @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.

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      paper_lung @aaronventure
                      last edited by

                      @aaronventure Thanks, that makes sense. Are you doing this within the Slider LLAF or are you adding a new function?

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @paper_lung
                        last edited by

                        @paper_lung yes it's the LAF/paint routine

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        46

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts