See if this code snippet helps. BTW, no need to really allocate any memory
if you just want to find out how big an object is.
UInt16 myGetButtonWidth(UInt16 buttonID){
FormPtr form=FrmGetActiveForm();
RectangleType r={{0,0},{0,0}};
FrmGetObjectBounds (form, FrmGetObjectIndex(form,buttonID), &r);
Return r.extent.x;
}
Bob.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ariel
Ayala
Sent: Monday, April 19, 2004 7:45 PM
To: Palm Developer Forum
Subject: Re: Width of an object
Bob:
Thanks for your answer, but I can�t figure out what you are trying to
explain very well (sorry). Moreover, previously to call
'FrmGetObjectBounds()', I do:
MemSet(&rtObject, sizeof(rtObject), 0);
to initialize the Rectangle Type variable in wich I want to get the
results of 'FrmGetObjectBounds()' ('rtObject' variable).
You tell me that I have to update the size of the rectangle to match the
object that I want to test. But... how can I do that?
Ariel A. Ayala
Software Development
----- Original Message -----
From: "Robert Moynihan" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, April 19, 2004 8:23 PM
Subject: RE: Width of an object
> Well then, that rectangle (rtObject) must ALWAYS be 59 pixels wide. You
> have to update the size of the rectangle to match the object that you want
> to test, probably using
>
> FrmGetObjectBounds (const FormType *formP,UInt16 objIndex, RectangleType
rP)
>
> After running THAT function, rP will be a rectangle that is the size of
your
> control.
>
> Bob.
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ariel
> Ayala
> Sent: Monday, April 19, 2004 7:14 PM
> To: Palm Developer Forum
> Subject: Re: Width of an object
>
> Thanks for the reply. But... I know that the 'extent.x' member of the
> structure don't specify the bottom-right corner of the rectangle, if you
are
> trying to say so. But the problem is, as exposed in my original message,
> that the function ALWAYS returns the same value, i.e.:
>
> rtObject.extent.x == 59
>
> Ariel Ayala
> Software Development
> ----- Original Message -----
> From: "SLO Revo News" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Monday, April 19, 2004 6:46 PM
> Subject: Re: Width of an object
>
>
> > > To calculate the width,
> > >I suppose I can do:
> > >
> > > uiWidth = rtObject.extent.x - rtObject.topLeft.x;
> >
> > The extent IS the width in pixels, not the right-hand pixel location.
> >
> > --
> > Regards,
> > Steve Mann
> > ---
> > steve-at-slorevo.com
> > Available for Contract Work
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
> >
> >
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/