ColumnsUI scripting help, How do I repaint more than once per second? |
![]() ![]() |
ColumnsUI scripting help, How do I repaint more than once per second? |
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? |
|
|
|
Oct 24 2012, 21:05
Post
#2
|
|
|
Group: Members Posts: 30 Joined: 14-October 12 Member No.: 103838 |
|
|
|
|
Oct 24 2012, 21:15
Post
#3
|
|
![]() Group: Members Posts: 2771 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 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/
|
|
|
|
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 |
|
|
|
Oct 24 2012, 22:25
Post
#5
|
|
|
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. Never mind, I got it working! Thanks for pointing me in the right direction. I couldn't have done it without you. |
|
|
|
Oct 24 2012, 23:14
Post
#6
|
|
![]() Group: Members Posts: 2771 Joined: 12-November 06 Member No.: 37463 |
you're welcome, happy you have figure it out
-------------------- http://br3tt.online.fr/
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd May 2013 - 00:47 |