IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
ColumnsUI scripting help, How do I repaint more than once per second?
eamon123
post Oct 24 2012, 19:57
Post #1





Group: Members
Posts: 30
Joined: 14-October 12
Member No.: 103838



Right now I'm using

CODE
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?
Go to the top of the page
+Quote Post
eamon123
post Oct 24 2012, 21:05
Post #2





Group: Members
Posts: 30
Joined: 14-October 12
Member No.: 103838



QUOTE (eamon123 @ Oct 24 2012, 19:57) *
Right now I'm using

CODE
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
function on_playback_time(Time){
    window.Repaint();
}
Go to the top of the page
+Quote Post
Falstaff
post Oct 24 2012, 21:15
Post #3





Group: Members
Posts: 2797
Joined: 12-November 06
Member No.: 37463



you can in wsh by using a timer

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

CODE
// 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

This post has been edited by Falstaff: Oct 24 2012, 21:18


--------------------
http://br3tt.online.fr/
Go to the top of the page
+Quote Post
eamon123
post Oct 24 2012, 21:42
Post #4





Group: Members
Posts: 30
Joined: 14-October 12
Member No.: 103838



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.

This post has been edited by eamon123: Oct 24 2012, 21:42
Go to the top of the page
+Quote Post
eamon123
post Oct 24 2012, 22:25
Post #5





Group: Members
Posts: 30
Joined: 14-October 12
Member No.: 103838



QUOTE (eamon123 @ Oct 24 2012, 21:42) *
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.
Go to the top of the page
+Quote Post
Falstaff
post Oct 24 2012, 23:14
Post #6





Group: Members
Posts: 2797
Joined: 12-November 06
Member No.: 37463



you're welcome, happy you have figure it out wink.gif


--------------------
http://br3tt.online.fr/
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th April 2014 - 20:52