Page 1 of 1

Rubber banding/bounding box selection

Posted: Fri Jan 06, 2017 5:30 pm
by chris
How does Workbench draw the "rubber band" for drag selections?

I want something similar which draws above all my windows like the WB one, although it doesn't particularly need to be animated.

Ideally I would like to just tell Intuition to draw it and give it the co-ordinates, but I can't see that that is possible?

Re: Rubber banding/bounding box selection

Posted: Fri Jan 06, 2017 9:36 pm
by broadblues
Exactly what WB does I don't know.

In SketchBlock I do it but drawing lines with pattern setup via the gfx.library API and the using complement mode, so you can draw and erase without needing to save any backup bitmap.

Safely drawing over the whole screen might need you to lock and / or copy the screen in someway. Not sure if there is an external method to lock the workbench in the way the workbench does whilst dragging icons drawing the crawling ants etc...

Re: Rubber banding/bounding box selection

Posted: Sat Jan 07, 2017 2:05 am
by chris
broadblues wrote:Exactly what WB does I don't know.

In SketchBlock I do it but drawing lines with pattern setup via the gfx.library API and the using complement mode, so you can draw and erase without needing to save any backup bitmap.
I think that's how I tried to do it originally (a long time ago) and got in a state and gave up. I will try it again.

I thought it might be easier to do something which draws over the entire screen the way WB does, maybe with a transparent layer. I don't actually need to transcend window borders.

It's a shame WB (or, better, Intuition) doesn't expose this sort of functionality, along with the icon dragging visual imagery.

Re: Rubber banding/bounding box selection

Posted: Mon Jan 09, 2017 7:46 pm
by xenic
chris wrote: I think that's how I tried to do it originally (a long time ago) and got in a state and gave up. I will try it again.

I thought it might be easier to do something which draws over the entire screen the way WB does, maybe with a transparent layer. I don't actually need to transcend window borders.

It's a shame WB (or, better, Intuition) doesn't expose this sort of functionality, along with the icon dragging visual imagery.
Workbench isn't drawing the box on the screen; it's drawing it on a background window. If you uncheck the menu item Workbench/Backdrop? you will see that you can't draw the box on the screen; only in the window.

I found an example in my OS3 developer CD's called freedraw (with source) that let's you draw a non-animated rubberbanding box in a window. There is an older version of the program on Aminet that has the source too.

Dopus5 does the same animated box as Workbench. It looks to me like it might be an animated BOB. The Dopus5 sources are at SourceForge but it could be difficult to track down the correct functions in that massive amount of code (backdrop_drag.c & drag_routines.c ??).

Re: Rubber banding/bounding box selection

Posted: Mon Jan 09, 2017 8:19 pm
by chris
xenic wrote:Workbench isn't drawing the box on the screen; it's drawing it on a background window. If you uncheck the menu item Workbench/Backdrop? you will see that you can't draw the box on the screen; only in the window.
That's not entirely true. It is perfectly happy to draw over the screen, you just can't start the drag from the screen (presumably because it needs a window to detect the click events).
I found an example in my OS3 developer CD's called freedraw (with source) that let's you draw a non-animated rubberbanding box in a window. There is an older version of the program on Aminet that has the source too.

Dopus5 does the same animated box as Workbench. It looks to me like it might be an animated BOB. The Dopus5 sources are at SourceForge but it could be difficult to track down the correct functions in that massive amount of code (backdrop_drag.c & drag_routines.c ??).
I'll have a look at those, thanks.

Re: Rubber banding/bounding box selection

Posted: Tue Jan 10, 2017 11:12 am
by salass00
@chris

You should read up on the LockScreen() and UnlockScreen() functions in the intuition.library autodoc. They are made specifically for this purpose.