Rubber banding/bounding box selection

This forum is for general developer support questions.
Post Reply
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Rubber banding/bounding box selection

Post 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?
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Rubber banding/bounding box selection

Post 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...
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Rubber banding/bounding box selection

Post 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.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Rubber banding/bounding box selection

Post 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 ??).
AmigaOne X1000 with 2GB memory - OS4.1 FE
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Rubber banding/bounding box selection

Post 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.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: Rubber banding/bounding box selection

Post 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.
Post Reply