B4J Question Help with scrolling while dragging.

MrKim

Well-Known Member
Licensed User
Longtime User
I have project with a scrollpane with a lot of lists with a lot of controls.
I have drag and drop working OK the problem is sometimes,when dragging the target will be off the screen. When I drag to the edge of the screen I need to begin scrolling. I though about using the underlying pane but it will not always be available because the lists will be covering the edges.bars

Anybody have any ideas on the best way to accomplish this?
Is it possible to make the scrollpane scrollbars part of a drag and drop?

I have included a sample project.

Thanks in advance for any ideas.
 

Attachments

  • SkSchedule-TEST2.zip
    9.7 KB · Views: 247

MrKim

Well-Known Member
Licensed User
Longtime User
It doesn't look like it will. I have multiple listviews oriented horizontally but generally you're moving from one list to view to another. The Location you want could be off the screen both horizontally and vertically.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Here is one possible solution: add panes as targets at the edges of the view and when an item is dragged over them start a timer to scroll the scrollpane. Stop when the drag exits the panes or is dropped (this is automatic).

The attached implements scroll up only and doesn't resize the pane if the form is resized you can implement that with the rest of the panes if you decide to try it, you are not helping yourself by not using the designer.
 

Attachments

  • SkSchedule-TEST2.zip
    10 KB · Views: 217
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
Here is one possible solution: add panes as targets at the edges of the view and when an item is dragged over them start a timer to scroll the scrollpane. Stop when the drag exits the panes or is dropped (this is automatic).

The attached implements scroll up only and doesn't resize the pane if the form is resized you can implement that with the rest of the panes if you decide to try it, you are not helping yourself by not using the designer.
Yeah. I started that, put them one the layout with the ScrollPane but then they wind up outside the scrollbars which looks and acts kind of hokey. Next I guess I'll try putting them on the ScrollPane.innernode. The problem with that of course is the innernode will frequently be much larger than the form/ScrollPane which means I need to figure out how to place them on the edge on resize, and figure out and allow for the the width of the scrollbar if it is visible. Which makes me wonder, is the scrollbar width fixed or is that settable in windows?
Guess I am going to have to play around with this
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Sorry the attachment was missing somehow managed to remove it :)
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
I solved this by putting a 10 pixel pane on all 4 sides, making them drag targets and scrolling while the user is over them. Could not find a simpler way, and it meant giving up some screen real estate on every side.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
meant giving up some screen real estate on every side.
You could put the panes over the scrollview right at the edges with visible initially set to false and make visible = true only when an item is being dragged. That way you can claim back the space.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
You could put the panes over the scrollview right at the edges with visible initially set to false and make visible = true only when an item is being dragged. That way you can claim back the space.
Good idea! Thank you.
 
Upvote 0
Top