Preset Browser (doesn't follow preset)



  • Hi guys,

    So I'm using the standard Preset Browser and 'previous / next' buttons to flick through presets. The browser doesn't 'follow' the presets when I've flicked through the list, further down the window/panel.

    Does anyone know if it's possible for the list to move with the buttons, so to speak?



  • Content.makeFrontInterface(500, 400);
    
    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)
    					Engine.loadNextUserPreset(true);
    				else
    					Engine.loadPreviousUserPreset(true);		
    			}
        	
    			this.repaint();
    		});
    		return widget;
    	};
    
    	inline function createPresetDisplay(name, x, y)
    	{
    		local widget = Content.addPanel(name, x, y);
        
    		Content.setPropertiesFromJSON(name, {
    		"width": 280,
    		"height": 25,
    		});
        
        
    		widget.setPaintRoutine(function(g)
    		{
    			g.fillAll(this.data.hover ? 0xFF252526 : 0xff363636);
    			g.setColour(0xAA212121);
    			g.drawRect([0, 0, this.getWidth(), this.getHeight()], 2);
    			g.setFont("Montserrat", 21.0);
    			g.setColour(0xFF65B17C);
        	
    			g.drawAlignedText(Engine.getCurrentUserPresetName(), [5, 0, this.getWidth(), this.getHeight()], "centred");
    		});
        
    		widget.setTimerCallback(function()
    		{
    			this.repaint();
    		});
        
    		widget.startTimer(300);
    	
        
    		widget.setMouseCallback(function(event)
    		{
    			this.data.hover = event.hover;
    			this.repaint();
    		});
    		return widget;
    	};
    
    }
    
    
    const var UpButton = UserPresetWidgets.createPresetButton("UpButton", 442, 11, true);
    const var DownButton = UserPresetWidgets.createPresetButton("DownButton", 421, 11, false);
    const var PresetDisplay = UserPresetWidgets.createPresetDisplay("PresetDisplay", 130, 5);
    Engine.loadNextUserPreset(1);
    


  • @DanH Are you looking something to change presets by button?



  • @Rudra-Ghosh No, I'm already doing that, I'll post a vid later on to explain it properly 😂



  • @DanH do you mean you move thru the presets with your button - but in the browser the current preset isnt highlighted?

    if so I dont think theres a way to fix that.



  • @Lindon Yes that's what I mean 🙂 thanks!



  • Actually it should update the browser list automatically.



  • @Christoph-Hart said in Preset Browser (doesn't follow preset):

    Actually it should update the browser list automatically.

    Yeah, seems to work here in the latest scriptnode.

    Peek 2021-03-13 13-14.gif



  • @d-healey I stand corrected!



  • @Christoph-Hart Sorry I've confused things, here's a vid of what I mean:

    test3.gif

    So the highlighted / selected Preset isn't visible outside of the Panel. Would be nice if the list moves with the selection.

    Does that make sense?!



  • @DanH You mean you want the list to auto-scroll, sound like a good idea to me.



  • @d-healey yep - my vote too...



  • @d-healey auto-scroll... that's what I mean lol - @Christoph-Hart any chance?


Log in to reply
 

16
Online

1.2k
Users

3.9k
Topics

34.4k
Posts