Ok, I realized I glossed over some of the details by
accident - I'll pick apart your response and add them
in... :-)
--- Keith Rollin <[EMAIL PROTECTED]> wrote:
> At 10:27 PM -0700 6/1/02, Craig Belson wrote:
> >I have 5 fields that can accept text, and a struct
> that I created 
> >that consists of 5 chars.  What I'm looking to do
> is store the text 
> >input in the fields in the struct, the first field
> to the first 
> >char, etc...
> 
> I guess I'm still not getting it.  How are you
> assigning a whole 
> field to just a single char?  Do your fields accept
> only a single 
> character?  Or are you snagging just the first
> character from each 
> field?
> 
Sorry - I meant to say char[]s... when my friends and
I are discussing code, we just say char, so I didn't
even realize I typed it that way...


> >The way I was taught to do this would be to get a
> FieldPtr for the 
> >first field, then get the text pointer for the
> contents of the field 
> >- from there, we could write the text to our
> struct... (so if that's 
> >bad like you said, don't blame me, blame my CS
> professor. *smiles*)
> 
> I didn't say that was bad.  I said that accessing a
> form's data 
> directly was bad.  More explicitly, using
> "frmP->objects->object" is 
> bad.
> 
I don't use that directly - I discovered that it's
frmP->objects->object via the debugging window in
Codewarrior 


> The title of your e-mail said "FrmGetObjectPtr
> question", but I've 
> yet to see you actually use FrmGetObjectPtr.
I cast the result of the function call - it ends up
being
frmP=(FieldPtr)FrmGetObjectPtr(frmP,FrmGetObjectIndex(frmP,EnterInfoAlbumNameField));

> 
> However, since you *are* accessing data members
> directly, you might 
> be able to narrow down your crash by breaking things
> up.  Access 
> "frmP->objects" first, then "frmP->objects->object".
>  The one that 
> causes your crash might tell you something.  For
> instance, if the 
> first one causes the crash, then you know that
> "frmP" is invalid for 
> some reason.
I set frmP with (go figure) FrmGetActiveForm() in the
switch, but before any of the cases... so, for the
sake of argument, if the address for frmP ends in A,
for frmP->objects ends in C, and frmP->objects->object
ends in E (I know that's not how it actually is, but
for the sake of the example, let's just call it that),
I compared the address of the bus error to the
addresses listed in the debugging window, and it
matched up with frmP->objects->object perfectly - all
the way down to the E.


Clear things up any?  Sorry for being a bit
confusing... :-)

-Craig


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to