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