Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ColumnsUI scripting help (Read 1856 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ColumnsUI scripting help

Right now I'm using

Code: [Select]
function on_playback_seek(time){
    window.Repaint();
}


To repaint a seekbar. But I would like it to move more smoothly. Is there a way to make it update every millisecond?

ColumnsUI scripting help

Reply #1
Right now I'm using

Code: [Select]
function on_playback_seek(time){
    window.Repaint();
}


To repaint a seekbar. But I would like it to move more smoothly. Is there a way to make it update every millisecond?


Edit:

Code: [Select]
function on_playback_time(Time){
    window.Repaint();
}

ColumnsUI scripting help

Reply #2
you can in wsh by using a timer

quick way without testing but the goal is to explain you the trick, after, adapt it

Code: [Select]
// global variable declaration for the timer
var refresh_timer = false;

function on_playback_new_track() {
// on new track, kill the current timer if running (=true), then set a new one with function to execute on each delay reached, below, refresh is set every 250 ms
if(refresh_timer) {
window.ClearInterval(refresh_timer);
refresh_timer = false;
}
refresh_timer = window.SetInterval(function() {
window.Repaint(); // bigger is your panel, more %cpu a repaint will consume, think about window.RepaintRect(x,y,w,h) instead of a Whole Repaint if you seekbar is only a small part of the panel
}, 250);

}

function on playback_stop() {
// kill the interval timer on playback stop
if(refresh_timer) {
window.ClearInterval(refresh_timer);
refresh_timer = false;
}
}


check samples that come with WSH Panel Mod component (in the zip), there are examples, and one for the timers too

HTH

 

ColumnsUI scripting help

Reply #3
Sorry man, I have no fluency in javascript, I don't know how to fix that, it just crashes. If it's too much to ask to fix it I will try and learn myself... let me know anyway.

ColumnsUI scripting help

Reply #4
Sorry man, I have no fluency in javascript, I don't know how to fix that, it just crashes. If it's too much to ask to fix it I will try and learn myself... let me know anyway.

Never mind, I got it working! Thanks for pointing me in the right direction. I couldn't have done it without you.