SPACE_AreaBox broken?

This forum is for general developer support questions.
Post Reply
User avatar
tbreeden
Posts: 160
Joined: Sat Jun 18, 2011 1:57 am
Location: Charlottesville, VA, USA
Contact:

SPACE_AreaBox broken?

Post by tbreeden »

I'm unable to get reasonable results when doing a GetAttrs() for SPACE_AreaBox. (4.1 upd 6, SDK 53.20).

The function returns 1, and the IBox variable is written into, but the values don't make any sense.
Doing a GetAttrs() for GA_LEFT/TOP/WIDTH/HEIGHT does work.

The main thing is that the GA_xxxx values include the bevel part when SPACE_BevelStyle is not none.
From the Autodocs, I got the idea that SPACE_AreaBox should be only the inner area, not including the
bevel pixels.

eg, for GA_LEFT returned as 7, GA_TOP 33, GA_WIDTH 696, GA_HEIGHT 468
the corresponding SPACE_AreaBox values might be box.Left of 23989, box.Top of -26296, box.Width of 0, box.Height of 0

The box.Left and box.Top seem to be pretty random (with the same size Space they may be quite different next time, but the box.Width and box.Height always 0. I explicitly initialized the IBox to 0's before the GetAttrs().

Anyone seen this?

Thanks,

Tom
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 363
Joined: Mon Jan 17, 2011 9:42 pm

Re: SPACE_AreaBox broken?

Post by Rigo »

How are you getting that attribute? Can you post the source line that queries for it?

Simon
User avatar
thomasrapp
Posts: 318
Joined: Sun Jun 19, 2011 12:22 am

Re: SPACE_AreaBox broken?

Post by thomasrapp »

GetAttr(SPACE_AreaBox) fills in a pointer to an IBox, it does not fill in an IBox you supply.

This works right:

Code: Select all

struct IBox *box;
GetAttr (SPACE_AreaBox,spaceobject,&box);
Printf ("x=%ld; y=%ld; w=%ld; h=%ld\n",box->Left,box->Top,box->Width,box->Height);
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: SPACE_AreaBox broken?

Post by tonyw »

Also remember that the contents of the IBox are 16-bit words, not 32-bit longs. If you use an expression like DebugPrintF ("%ld\n", IBox->xxx), you will read junk. You have to either copy the 16-bit values to 32-bit variables before printing, or cast the printed args.
cheers
tony
User avatar
thomasrapp
Posts: 318
Joined: Sun Jun 19, 2011 12:22 am

Re: SPACE_AreaBox broken?

Post by thomasrapp »

tonyw wrote: If you use an expression like DebugPrintF ("%ld\n", IBox->xxx), you will read junk.
That's not true. The compiler will convert the values to 32bit. It's rather so that you have to use %ld even for 16bit values and you will get junk if you use %d.
User avatar
tbreeden
Posts: 160
Joined: Sat Jun 18, 2011 1:57 am
Location: Charlottesville, VA, USA
Contact:

Re: SPACE_AreaBox broken?

Post by tbreeden »

thomasrapp wrote:GetAttr(SPACE_AreaBox) fills in a pointer to an IBox, it does not fill in an IBox you supply.
Indeed, that was the problem. I was expecting it to fill in the IBox in my program for which I put the address into the TagData.

Tom
Post Reply