>1.  Is there any way to determine at runtime when it's okay to draw a
particular form object?

UI objects generally have status information about if they're visible.  For
fields, use FldGetAttributes.  Another useful routine is FrmVisible.


>2.  Is there a proper way to initialize form objects before drawing,
particularly if the debug ROM is making my form pointer invalid?

The sequence for form is:
FrmInitForm
FrmSetActiveForm
FrmDrawForm
FrmEraseForm
FrmDeleteForm

Calling FrmSetActiveForm sets it as active so that FrmGetActiveForm works fine.
What's a bit different is that the DrawWindow isn't set now until FrmDrawForm is
called.  This points out where draws are drawn before FrmDrawForm, which
overwrites them anyways.

Note that this means you also can't read from the DrawWindow before FrmDrawForm,
because it's not valid for that form.  Calls like FrmGetFormBounds work wonders
as substitutes for WinGetWinBounds!


>I'm worried that I may not be able to do any initialization at all

So to summarize, you should have no problems initializing your objects after
FrmSetActiveForm or drawing your objects after FrmDrawForm.


-Roger Flores







"Emry, Owen" <[EMAIL PROTECTED]> on 11/01/99 10:59:13 AM

Please respond to [EMAIL PROTECTED]

Sent by:  "Emry, Owen" <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:    (Roger Flores/HQ/3Com)
Subject:  Form object initialization




At PalmSource, one thing hammered into us developers was that we shouldn't
be drawing anything on a form until we've called FrmDrawForm() to draw it.
The reason for this is that FrmDrawForm() is supposed to clear the screen
before drawing, not that it ever really has, but it's supposed to.

Say I have a function called FieldLoadString(FieldPtr fieldp, Char *text)
which automates the process of dumping text into a field.  That is to say,
it creates a new handle, copies in the text, sets the field's handle, frees
the old handle, and then _redraws the field_.  Problem.

The problem is that if I use this function to initialize my fields before
drawing, there's no way for the function to know whether or not to (re)draw
the field.  Unless of course I tell it.  Or is there a way?  (That's my
first question.)

Also:  I remember Bob Ebert saying that, as a way of enforcing the use of
FrmDrawForm() first, future debug ROMs will do something like make the
active form pointer invalid until FrmDrawForm() has been called.  (Did I get
that right, Bob?)

If that's the case, I'm worried that I may not be able to do any
initialization at all before FrmDrawForm(), whether or not I draw my form
objects.  If, for example, I try to initialize a selector trigger, I'll need
to get a FrmGetActiveForm() before I can get a pointer to the trigger in
question, or any other form object.

Um, so in summation:

1.  Is there any way to determine at runtime when it's okay to draw a
particular form object?
2.  Is there a proper way to initialize form objects before drawing,
particularly if the debug ROM is making my form pointer invalid?

Thanks very much for any answers...

oge

----------
Owen G. Emry
Noblestar Systems Corp.
Mobile Computing Practice
[EMAIL PROTECTED]








Reply via email to