HISE Logo Forum
    • Categories
    • Register
    • Login

    One preset name behind on prev/next buttons

    Scheduled Pinned Locked Moved General Questions
    2 Posts 2 Posters 234 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.
    • JayJ
      Jay
      last edited by Jay

      When trying to show the preset name on a Label using prev/next buttons, it always shows a preset name behind on both of this example

      namespace UserPresetWidgets
      {
      	inline function createPresetButton(name, x, y, up)
      	{
      		local widget = Content.addPanel(name, x, y);
          
      		Content.setPropertiesFromJSON(name, {
      		"width": 10,
      		"height": 15,
      		"saveInPreset": false,
      		"allowCallbacks": "Clicks & Hover"
      		});
          
      		widget.data.up = up;
          
      		widget.setPaintRoutine(function(g)
      		{
      			g.setColour(this.data.hover ? 0xFF65B17c : 0xFF2C4433);
      			g.fillTriangle([0, 0, this.getWidth(), this.getHeight()], this.data.up ? Math.PI/2 : 1.5 * Math.PI);
      		});
          
      		widget.setMouseCallback(function(event)
      		{
      			this.data.hover = event.hover;
          	
      			if(event.clicked)
      			{
      				if(this.data.up)
      				{
      					convoLbl1.set("text", Engine.getCurrentUserPresetName());
      					Engine.loadNextUserPreset(true);
      				}
      				else
      				{
      					convoLbl1.set("text", Engine.getCurrentUserPresetName());
      					Engine.loadPreviousUserPreset(true);
      				}
      			}
      			this.repaint();
      		});
      		return widget;
      	};
      }
      
      const var UpButton = UserPresetWidgets.createPresetButton("UpButton", 749, 10, true);
      const var DownButton = UserPresetWidgets.createPresetButton("DownButton", 736, 10, false);
      
      
      
      
      
      // ============== second attemp
      
      // next
      inline function onnextBtnControl(component, value)
      {
      	convoLbl1.set("text", Engine.getCurrentUserPresetName());
      	Engine.loadNextUserPreset(true);
      };
      Content.getComponent("nextBtn").setControlCallback(onnextBtnControl);
      
      // prev
      inline function onprevBtnControl(component, value)
      {
      	convoLbl1.set("text", Engine.getCurrentUserPresetName());
      	Engine.loadPreviousUserPreset(true);
      };
      Content.getComponent("prevBtn").setControlCallback(onprevBtnControl);
      
      

      @pluginboi

      Joansi Villalona

      ulrikU 1 Reply Last reply Reply Quote 0
      • ulrikU
        ulrik @Jay
        last edited by

        @Jay see here:
        https://forum.hise.audio/topic/7814/how-to-make-it/15

        Hise Develop branch
        MacOs 15.3.1, Xcode 16.2
        http://musikboden.se

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

        16

        Online

        1.8k

        Users

        12.1k

        Topics

        105.5k

        Posts