Page 1 of 1

SPACE_AreaBox broken?

Posted: Thu Dec 27, 2012 4:08 am
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

Re: SPACE_AreaBox broken?

Posted: Thu Dec 27, 2012 10:00 am
by Rigo
How are you getting that attribute? Can you post the source line that queries for it?

Simon

Re: SPACE_AreaBox broken?

Posted: Thu Dec 27, 2012 10:51 am
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);

Re: SPACE_AreaBox broken?

Posted: Thu Dec 27, 2012 2:07 pm
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.

Re: SPACE_AreaBox broken?

Posted: Thu Dec 27, 2012 6:33 pm
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.

Re: SPACE_AreaBox broken?

Posted: Sat Dec 29, 2012 2:51 am
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