PDA

View Full Version : <scrollbar scrolltarget... broken?


twashing
06-20-2003, 07:17 AM
I have a view and 2 scrollbars (x and y axis) that I want to scroll over the view. The "scrolltarget" attribute does not affect the target however (I am trying the "parent" and "immediateparent" values).

The scrollbar,if the "scrolltarget" attribute is not set, will reference whatever's on top of it. So with 2 scrollbars, the first one scrolls the view. The 2nd one scrolls the scrollbar abouve it - I want both scrollbars affecting one view.

If the scrollbar's scrolltarget is set, nothing scrolls. I tried having the target use the "name" and "id" attribute. Then having the scrollbars reference the target... nothing.

Has anyone else had problems had with this?

not working:
<view id="theview" bgcolor="0xaabbcc">
...
</view>

<rscrollbar axis="y" scrolltarget="theview" height="theview.height - 15"/>
<rscrollbar axis="x" scrolltarget="theview" width="theview.width - 15"/>

antun
06-20-2003, 08:52 AM
Hey twashing

You have the right idea. Using scrolltarget should work, but unfortunately it's not well documented :(

What you need to do is to set the scrolltarget attribute when the scrollbar inits (because its a pointer):


<scrollbar scrolltarget="$once{theview}" />


The $once{...} sytax is a replacement for the more verbose older:


<scrollbar axis="x">
<attribute name="scrolltarget" init="theview" />
</scrollbar>


... if you've been using the LPS since DR.

I think you'll still have to do some tweaking to get the scrollbars to not overlap.

-Antun

twashing
06-20-2003, 09:33 AM
It works - thanks. The target view now scrolls. I didn't see this in the "scrollbar" or "script" documentation - is it easy to put in?

There's also another problem...

The horizontal scrollbar scrolls the view, but in the wrong direction. So when I move the scrollbar left-right, I expect the view to shift from right-left.
Instead, the view moves in the same direction as the scrollbar, left-right.

Is there another trick to overcome this one?


Tim

twashing
06-20-2003, 09:51 AM
Let me modify my last post. The scrollbars on the x and y axis work fine as long as there is one of them.

If there are 2 like below, the x axis will work fine and the y will move the target view the same direction as it is being moved (the view should have negative relationship when the scrollbar moves).
<scrollbar axis="x" scrolltarget="$once{theview}" width="immediateparent.width - 15"/>
<scrollbar axis="y" scrolltarget="$once{theview}" height="immediateparent.height - 15"/>

If the order of the scrollbars is flipped, the y axis will work fine and the x axis will move the view in the same direction.

Am I missing an important layout semantic? Does this qualify as a bug?


Tim

antun
06-20-2003, 12:33 PM
This does appear to be a bug. I've logged it, but I'll see what I can do as a workaround. I'm not sure if I'll be able to get you one, because the Redmond components (which contain scrollbar) are old, and the code is not modern-day LZX, so it may be hard to work with. We are working on all-new components that will be written in clean up-to-date LZX.

In the meantime, if you're feeling adventurous, you might want to look at the scrollbar component in the calendar app:

C:\lps-v1\jakarta-tomcat-4.1.12\webapps\lps-v1\sample-apps\calendar\vscrollbar.lzx

It needs some images to run, but you could play with that and get it to work on the x-axis.

-Antun

twashing
06-23-2003, 08:11 AM
Well, I took a look at the "redmonscrollbar.lzx" file and the scrolltarget attribute is just not being passsed in.

Firstly, the "Scrollbar.prototype.initialize" is looking for the "scrolltarget" attribute in the "args" object. But the interpreter has shoved the "scrolltarget" inside of the "refs" array.

So I would do:
if (args.refs.scrolltarget == null) {


... instead of:
if (args.scrolltarget == null) {


But the scrolltarget is still not found in this case. I can't find the "view.lzx" file, so I don't know how the "args" object is being created, but the $once{idname} is not finding the reference. And if it is, it's not being passed to the "Scrollbar" class.

Hope this helps.

Tim