Hello all, I am pretty new at the whole DesktopX scripting/creating stuff (not new at programming or scripting), and need a little help.
I created a lyrics displaying object that becomes visible when MediaMonkey or WinAmp is running and dissapears when the program is shut off. The object reads the currently playing lyrics from a text file and displays it on the desktop in a nice frame (from one of RomanDA's tutorials...thank you). The object checks the text file for changes every few seconds and if it changes, it updates the text in the object, but only updates when one of the media programs is running (saving processor cycles). Everything works great!
Sometimes the lyrics file is too long to fit completely in my object. I have a large desktop 1920 x 1200 on a 28" monitor so the object is fairly large...not a problem...but I don't want it any larger. I want to be able to add a scrollbar to the object to allow the user (me or my kids) to scroll the text up or down if needed.
Any suggestions? Is there anything native in DesktopX that would allow this, or would my best bet be to use an ActiveX control to accomplish this.
I appreciate any assistance on this.
Thank you very much,
Erik
How about this tutorial - LINK I use it all the time.
I think that is exactly what I needed...I will try it out.
Thanks for the point in the right direction.
No prob. Hope it works for you.
It works great...Thanks for the help...now to see what else I need to add.
Again, Thanks,
OK...there seems to be a slight problem. It works fine except for the following...could be me doing something silly.
I used the example pretty much exactly as it was shown, the problem is:
the Scroll_Dot object uses the absolute screen coordinates for the scrolling computation, even if I make it the child of the container (it does not use the relative coordinates for it's location to it's parent). So the scrolling works beautifully if I don't move the container. Once I move the container the scrolling gets all messed up as it is using the coordinates to where it was located to calculate the scroll position. As long as I only do horizontal movement...no problem, but if I move the conainer in the vertical direction things go crazy.
I hope this makes sense.
Any suggestions?
I don't think the dot should use screen coordinates. Did you try going to Properties > Summary and set child to 'yes' (sometimes you have to do that manually, and input the correct xy coordinates there.)
I did that. Even if I set it to child it uses the screen coordinates, not the coordinates within the container. I set everything manually.
I tried addressing the object in script as
object.Top
and
DesktopX.Object("Scroll_Dot").Top
didn't matter. Still uses screen coordinates.
That's weird. It really won't work with screen coordinates and I haven't a clue why it won't set child.
Another alternative I use is to have an up and down button. It scrolls the text up or down as long as you hold down the button. I did this once, when there was no room for a scrolling button. You'd create two objects named "up" and "down" The script should go in the parent object of the buttons (which should be the base container object.)
The action is in three parts.
1. OnLButtonDownEx, depending on which button you clicked, it sets the variable 'scrDir' to up or down and starts the timer. There is also a redundancy If Then so that it doesn't scroll when the text isn't longer than the designated space.
2. OnTimer, depending on the 'scrDir' variable it moves the text object up or down, 2 pixels per cycle (you can adjust either the variable or the timer to make the scrolling go faster or slower)
3. OnLButtonUpEx, it kills the timer to stop the scrolling.
This might work for you. Script's below:
Dim scrDir
'Called when L-click on object or its childrenFunction Object_OnLButtonUpEx(obj, x, y, dragged) If dragged Then Exit Function Select Case obj.name Case "down" , "up" object.KillTimer 3 End SelectEnd Function
'Called when L-click is pressedFunction Object_OnLButtonDownEx(obj,x,y) Select Case obj.name Case "down" If desktopX.Object("text").height > desktopx.Object("mask").height Then scrDir = "down" object.SetTimer 3,10 End If Case "up" If desktopX.Object("text").height > desktopx.Object("mask").height Then scrDir = "up" object.SetTimer 3,10 End If End SelectEnd Function
Sub object_ontimer3 Select Case scrDir Case "down" If desktopX.Object("text").bottom > desktopX.Object("mask").height Then desktopX.Object("text").top = desktopX.Object("text").top - 2 End If Case "up" If desktopX.Object("text").top < 0 Then desktopX.Object("text").top = desktopX.Object("text").top + 2 End If End SelectEnd Sub
That script works very well. Even if things are moved. I appreciate your time and patience on this. I like this even better.
I am still curious why the other one doesn't work properly.
Again,
Thanks
Glad it works for you.
Here is the final Lyrics Object...provided I can get the image to work in this forum:
Nice work, Erik!
sViz...thanks a lot for all of your help.
There are many great features available to you once you register, including:
Sign in or Create Account