HISE Logo Forum
    • Categories
    • Register
    • Login

    Multiple different text colours/formats in one text box?

    Scheduled Pinned Locked Moved Unsolved General Questions
    11 Posts 4 Posters 442 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.
    • d.healeyD
      d.healey @cynthasiser
      last edited by

      @cynthasiser What is a text box in this context?

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

      C 1 Reply Last reply Reply Quote 0
      • C
        cynthasiser @d.healey
        last edited by

        @d-healey The text property of a label.

        LindonL C 2 Replies Last reply Reply Quote 0
        • LindonL
          Lindon @cynthasiser
          last edited by

          @cynthasiser use LAF

          HISE Development for hire.
          www.channelrobot.com

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

            @Lindon Do labels have laf?

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

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

              @d-healey said in Multiple different text colours/formats in one text box?:

              @Lindon Do labels have laf?

              if he cant get it done in a label - then he might have to use a panel-or a button...??

              HISE Development for hire.
              www.channelrobot.com

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

                @Lindon yeah I think a panel is a good choice

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

                1 Reply Last reply Reply Quote 0
                • C
                  cynthasiser @cynthasiser
                  last edited by

                  @cynthasiser Thanks for the reply, but could you be more specific? I thought look and feel was for setting a global aesthetic for the plugin.

                  My goal is to have a big list of frequencies on screen (the frequencies of every held note and a given number of their harmonics), for example:

                  C: 262___523___785___1047__1308...
                  E: 330___659___989___1317__1648...
                  G: 392 ___784__1176__1568__1960...

                  This information is stored in an array of arrays; an array for each note, which each contains the note's harmonics. I want to highlight any frequencies that are beating - we can see the third harmonic of C and the second harmonic of G are 1Hz apart for example. Let's say my criteria is any frequency within 20Hz of any other frequency in the list.

                  From what I can tell, if I used a panel, I'd need to set a paint routine and use g.drawText. I'd do a bunch of for loops to get the indexes of all values that i wanted to format and then do something like:

                  for (i = 0; i = noOfNotes.length; i++)
                  {
                  	for (j = 0; j = noOfHarmonics.length; j++)
                  	{
                  		local area = this.getLocalBounds(j * 20, i * 20);      //I'm not clear on how to set the area! Is this right?
                  		if ( noteNeedsFormatting == true) 	{g.setFont(highlightFont); g.drawText(exampleNote,  area); }
                  		else					{g.setFont(normalFont);	g.drawText(exampleNote,  area); }
                  	}
                  }
                  

                  And i could use set colour or set opacity where I've put set font, but is this generally right? I'd need to set the exact position of every frequency I wanted to display and then switch back and forth between my chosen formatting?

                  And finally, would this work in real time, reacting as I held and released notes?

                  Thanks again!

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

                    @cynthasiser said in Multiple different text colours/formats in one text box?:

                    And finally, would this work in real time, reacting as I held and released notes?

                    The GUI is not real-time, but it's close enough for the human eye.

                    Start with something simpler to get a feel for paint routines.

                    You can't use local in paint routines, you need to use var.

                    The formatting of your if statements is not so readable. Do it like this:

                    if (thing)
                    {
                       do stuff
                    }
                    else
                    {
                       do other stuff
                    }
                    

                    I'm not clear on how to set the area! Is this right?

                    If a function has "get" in the name, such as getLocalBounds then it's returning a value not setting a value.

                    I have a video about this specific function:

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

                    C 1 Reply Last reply Reply Quote 1
                    • C
                      cynthasiser @d.healey
                      last edited by

                      @d-healey Thanks for the quick response and the advice, I'll have a play around with paint routines. I was just being lazy with the if statements! And thank you so much for your videos generally, they're an incredible resource, and I wouldn't have gotten anywhere without them!

                      1 Reply Last reply Reply Quote 0
                      • ustkU
                        ustk
                        last edited by

                        Another way is to use a MarkdownRenderer and a panel, but it's not highly customisable.
                        So a simple panel with a neat paintRoutine is still a good choice

                        Can't help pressing F5 in the forum...

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

                        46

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts