HISE Logo Forum
    • Categories
    • Register
    • Login

    An Inline Progress Bar for Y'all

    Scheduled Pinned Locked Moved Presets / Scripts / Ideas
    1 Posts 1 Posters 211 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.
    • clevername27C
      clevername27
      last edited by clevername27

      Here's a progress bar for y'all. I use it for displaying progress bars on the UI (instead of a pop-up window). Each progress bar instance has a unique ID so a completion function can be called for each. Below is the raw code from my plugin; it's easy to adapt to your own.

      Progress bar code:

      //////////////// DISPLAY PROGRESS WINDOW ////////////////// 
      
      const var panel_HEADER_progressIndicator_Frame_ART = Content.getComponent("panel_HEADER_progressIndicator_Frame_ART");
      const var panel_HEADER_progressIndicator_Bar_GUI = Content.getComponent("panel_HEADER_progressIndicator_Bar_GUI");
      const var panel_HEADER_progressIndicator_Backing_ART = Content.getComponent("panel_HEADER_progressIndicator_Backing_ART");
      
      // ------------- Fade In Function
      
      inline function FadeInProgressBar () { panel_HEADER_progressIndicator_Bar_GUI.fadeComponent(true, 500);	
      };
      
      // ------------- Fade Out Function
      
      inline function FadeOutProgressBacking () { panel_HEADER_progressIndicator_Backing_ART.fadeComponent(false, 500); };
      
      // ------------- Progress Bar Animation Function
      
      inline function DisplayProgressWindow (timing) {
      	
      	// Draw bar.
      	panel_HEADER_progressIndicator_Backing_ART.fadeComponent(true, 500);
      	panel_HEADER_progressIndicator_Bar_GUI.set("width", 0);
      	Content.callAfterDelay(500, FadeInProgressBar, this.Object);	
      	panel_HEADER_progressIndicator_Bar_GUI.startTimer(timing);
      }
      
      // ------------- Progress Bar Callback Function
      
      panel_HEADER_progressIndicator_Bar_GUI.setTimerCallback(function() {
      
      	Animate.increase("width", panel_HEADER_progressIndicator_Frame_ART.getWidth(), 1); 	
      });
      
      // ------------- Post Animation Functions
      
      inline function PostAnimationActions() {
      
      	// Handle calling function specifics.
      	switch (global_animationCaller) {
      		
      		case "smart_settings": SetSmartSettingsActivation (true); break;
      		case "automix": SetAutoMixActivation(true); break;
      		case "infinite_dr": SetInfiniteDynamicRangeActivation(true); break;	
      		case "extractprofile": DoProfileExtracted (); break;
      	}
      	
      	global_animationCaller = "none";
      };
      

      Example of calling/creating a progress bar:

      ///////////////////////////////////// SMART SETTINGS //////////////////////////////////////// 
      
      // ------------- Callback Function
      
      // Register the callback function for when the button is pressed.
      button_SIMPLE_SmartSettings_GUI.setControlCallback(on_SIMPLE_SmartSettings_Control);
      
      inline function on_SIMPLE_SmartSettings_Control(component, value) {
      
      	if (value) { 
      	
      		global_animationCaller = "smart_settings";
      		DisplayProgressWindow(65); 
      	
      	} else {
      		
      		SetSmartSettingsActivation(false);
      	}		
      };
      

      Enjoy!

      progress.gif

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

      9

      Online

      1.7k

      Users

      11.8k

      Topics

      103.2k

      Posts