Forum

    • Register
    • Login
    • Search
    • Categories

    Change Text Colour on Hover and Clicked using PaintRoutine

    General Questions
    2
    3
    65
    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.
    • Tania Ghosh
      Tania Ghosh last edited by

      I am bit stuck on this code.. How can I change Text Colour on Hover and Clicked using Paint Routine.

      const var openwebsite = Content.getComponent("openwebsite");
      
      openwebsite.setPaintRoutine(function(g)
      {
       
          g.setColour(Colours.darkgrey);
          g.setFont("Arial",24);
          g.drawText("Open Website", [0,0,this.getWidth(),this.getHeight()]);
          
       });
      
      
      openwebsite.setMouseCallback(function(event)
      {
      	if(event.clicked)
          
      	    Engine.openWebsite("https://www.google.com");
          
      });
      

      Tania Ghosh

      1 Reply Last reply Reply Quote 0
      • iamlamprey
        iamlamprey last edited by

        https://docs.hise.audio/scripting/scripting-in-hise/scriptpanel.html#the-mouseevent-callback

        Add another if statement to the MouseCallback

        if(event.hover) 
        
        //change colour
        

        Music - Instruments

        Tania Ghosh 1 Reply Last reply Reply Quote 1
        • Tania Ghosh
          Tania Ghosh @iamlamprey last edited by

          @iamlamprey Superb got it.
          Thank you.

          Tania Ghosh

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

          13
          Online

          977
          Users

          6.6k
          Topics

          60.6k
          Posts