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
SPACE_AreaBox broken?
Re: SPACE_AreaBox broken?
How are you getting that attribute? Can you post the source line that queries for it?
Simon
Simon
- thomasrapp
- Posts: 318
- Joined: Sun Jun 19, 2011 12:22 am
Re: SPACE_AreaBox broken?
GetAttr(SPACE_AreaBox) fills in a pointer to an IBox, it does not fill in an IBox you supply.
This works right:
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);
- tonyw
- AmigaOS Core Developer
- Posts: 1483
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: SPACE_AreaBox broken?
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
tony
- thomasrapp
- Posts: 318
- Joined: Sun Jun 19, 2011 12:22 am
Re: SPACE_AreaBox broken?
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.tonyw wrote: If you use an expression like DebugPrintF ("%ld\n", IBox->xxx), you will read junk.
Re: SPACE_AreaBox broken?
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.thomasrapp wrote:GetAttr(SPACE_AreaBox) fills in a pointer to an IBox, it does not fill in an IBox you supply.
Tom