Rubber banding/bounding box selection

This forum is for general developer support questions.

Rubber banding/bounding box selection

Postby chris » Fri Jan 06, 2017 6:30 pm

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?
chris
 
Posts: 550
Joined: Sat Jun 18, 2011 12:05 pm

Re: Rubber banding/bounding box selection

Postby broadblues » Fri Jan 06, 2017 10:36 pm

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...
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 481
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Rubber banding/bounding box selection

Postby chris » Sat Jan 07, 2017 3:05 am

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.
chris
 
Posts: 550
Joined: Sat Jun 18, 2011 12:05 pm

Re: Rubber banding/bounding box selection

Postby xenic » Mon Jan 09, 2017 8:46 pm

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
xenic
 
Posts: 1054
Joined: Sun Jun 19, 2011 1:06 am

Re: Rubber banding/bounding box selection

Postby chris » Mon Jan 09, 2017 9:19 pm

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.
chris
 
Posts: 550
Joined: Sat Jun 18, 2011 12:05 pm

Re: Rubber banding/bounding box selection

Postby salass00 » Tue Jan 10, 2017 12:12 pm

@chris

You should read up on the LockScreen() and UnlockScreen() functions in the intuition.library autodoc. They are made specifically for this purpose.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 485
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 1 guest