ListBox Scrolling Problem

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by MichaelHill >> Wed, 1 May 2002 2:51:59 GMT

Afternoon All,

I have a listbox (see attachment : there are 25 commanders connected to the unconnected port), and it is not scrolling how I would expect it to. The main problem is if you are on commander 25 (which is at the bottom) and want to scroll it up to Com 1 up can't. It stops at the top of the listbox even though you are only at Commander 12 andwont' go any further. I have found that at this point if you take the drag out of bounds and down to the bottom and the come back continue back up then the instant you hit the bottom of the listbox it starts jumping irratically around the top half of the box.

What I'm trying to achieve is a smooth scroll at either the top or bottom of the listbox.

Is there something that has been missed that would be causing it to stop rather than scroll or for the irratic jumping around it does?

Any suggestions

Cheers

Michael Hill
Gallagher Group Ltd
Attachments

[The extension bmp has been deactivated and can no longer be displayed.]

Last edited by ConvertFromOldNGs on Fri Aug 07, 2009 3:33 pm, edited 1 time in total.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by cdshearer >> Wed, 1 May 2002 4:36:05 GMT

Hi Michael

This seems very odd. Is there something strange about the actual listbox control? Is it subclassed, and is the scrolling overridden in some way. From your description, the standard JADE ListBox displaying a hierarchy like this should work fine.

How about posting some of the code.

Craig

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by MichaelHill >> Wed, 1 May 2002 22:20:16 GMT

Hi Craig,

I did a little experiment after I sent this and found that the listbox does things differently if you have hasTreeLines set to true or not. If it is false then the scroll works as I was expecting it to, but once you have it set to true the way the scroll works changes. Have found that I need to change the topIndex property to get it to scroll correctly and that is what I'm working on at the moment.

Am I going in the right direction. And the contorl used was subclassed from listbox.

Michael

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by cdshearer >> Thu, 2 May 2002 0:31:43 GMT

Hi Michael

Glad you're making progress, but what exactly does it do differently when hasTreeLines is set to true? (That sounds like a bug, but not one that's I've encountered before).

I just tried a test form with a ListBox on it with the hasTreeLines property set to true. Here's my code:

vars
parentIndex,
newIndex : Integer;begin

newIndex := lstTest.addItem("1");
parentIndex := newIndex;
newIndex := lstTest.addItem("2");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("3");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("4");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("5");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("6");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("7");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("8");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("9");
lstTest.itemLevel[newIndex] := 2;
newIndex := lstTest.addItem("10");
lstTest.itemLevel[newIndex] := 2;
lstTest.itemExpanded[parentIndex] := true;
parentIndex := newIndex;

newIndex := lstTest.addItem("11");
lstTest.itemLevel[newIndex] := 3;
newIndex := lstTest.addItem("12");
lstTest.itemLevel[newIndex] := 3;
newIndex := lstTest.addItem("13");
lstTest.itemLevel[newIndex] := 3;
newIndex := lstTest.addItem("14");
lstTest.itemLevel[newIndex] := 3;
newIndex := lstTest.addItem("15");
lstTest.itemLevel[newIndex] := 3;
newIndex := lstTest.addItem("16");
lstTest.itemLevel[newIndex] := 3;
lstTest.itemExpanded[parentIndex] := true;
end;


It scrolls fine. Can you try this in your environment and report the results?

Craig

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by MichaelHill >> Fri, 3 May 2002 0:32:34 GMT

Craig,

Yep that code worked. Find attached my test scm & ddb files. The scrolling works if I have hasTreeLines set to false but not if it's set to true.

It's got to be something simple that I'm missing.

Cheers

Michael

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by cdshearer >> Fri, 3 May 2002 2:59:56 GMT

Ok Michael

I've loaded your schema and can't see any thing wrong (into 5.2.08.150). What exactly is meant to happen? Maybe I'm missing something here!

Craig

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by cdshearer >> Fri, 3 May 2002 11:31:31 GMT

To the group:

Michael emailed me privately, but I've now solved the problem, so in the interests of the group seeing the result, I post Michael's email below:

Hi Craig,

Hmmmmmmmmmm......

If I have this screen:

(Embedded image moved to file: pic06334.pcx)

i.e. hasTreeLines set to false then if I put the cursor on 'Commander 47' and drag the mouse up then it highlight the one and continues up or down when I hit the top or bottom of the listbox.

If I have this Screen:

(Embedded image moved to file: pic26500.pcx)

i.e. hasTreeLines set to true, then if I put the cursor on "Commander 47' and drag the mouse up then it doesn't do anything. It stays highlighted on 'Commander 47'

Did you change the state of the hasTreeLines programatically or via the painter. (I did it by the painter).

Michael

===================================================

Here's my reply:

I now see your problem. It wasn't clear to me, in your initial post, that you were talking about a problem with dragging and dropping. Now that I understand that's your problem, I can see what you mean.

For the benefit of other readers, the problem that Michael is talking about is that when using drag and drop on a listbox, you put it into a drag mode, and when in this mode, JADE doesn't scroll the ListBox when you drag the mouse over the boundary of the ListBox. This makes it impossible to drag the item onto another item that's not currently in view.

Firstly, there does seem to be an inconsistency in JADE in that when the treelines are turned off, JADE automatically scrolls the ListBox if you drag the mouse over the boundary. When treelines are turned on, it doesn't do this. Michael, you should raise a fault about this inconsistent behaviour.

However, the point is moot, because once in drag mode, JADE's ListBox control doesn't do any automatic scrolling, whether you have treelines turned on or off!

To me, the implementation of drag and drop in JADE has always been a little strange, and not very OO. However, we have to live with what we've got at the moment.

I've done some experimenting with the schema that Michael provided.

Firstly, Michael, in the schema you provided, there seemed to be a mistake in that the drag and mouse-move events were implemented on the exit button, not the ListBox. Was this intentional? I copied the code to the ListBox events and it started working correctly with the drag and drop. This allowed me to verify that indeed there was a problem with scrolling.

Anyway, my solution to the problem is as follows. I don't particularly like it, but it works, and if implemented correctly, might prove workable. Please see the attached schema for the solution.

Since JADE doesn't automatically handle scrolling when dragged beyond the ListBox's boundary, we have to handle it for ourselves. So, I put a couple of picture controls at the top and bottom of the ListBox. When the mouse is dragged onto these controls, they will handle changing the topIndex property of the ListBox to effect the scrolling behaviour. In my example, I've purposely left the picture controls visible, but you can make them transparent so the user can't see them.

When the mouse is dragged onto the picture control, it starts a timer of 150mS. Each time the timer fires the topIndex is changed by one. There are various events that stop the timer.

All in all, the solution works, but it is a bit of a hack, but the only way I see around it, apart of getting JADE to impelement some new functionality on the ListBox control to better support drag and drop.

[The extension pcx has been deactivated and can no longer be displayed.]

Regards,
Craig Shearer
Attachments
SchemaFiles.zip
(4.79 KiB) Downloaded 108 times

[The extension pcx has been deactivated and can no longer be displayed.]

Last edited by ConvertFromOldNGs on Fri Aug 07, 2009 4:02 pm, edited 1 time in total.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: ListBox Scrolling Problem

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:07 pm

by MichaelHill >> Sun, 5 May 2002 21:57:03 GMT

Hi Craig,

Thanks for that, will try implementing your suggestion and see if it fixes the problem well enough for testing to release it.

On the other matter of the inconsistancy, it has now been raised with support and has been converted to a PAR.

Michael


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 42 guests