I tried watching that with no success. The routine is being called in the
one place and not being called again. I added FldGrabFocus later and forgot
to remove it when it didn't do anything. It ran through and than went to
the system, stopping at that point. I was hoping to pick up an update call
or something where I had accidentally set it back to the previous field, but
it never changed. Even when I stepped through and got to the end of this
routine for setting the focus to the other field, it didn't move.
Now, I only had a problem when I set the field using FldDelete and
FldInsert. When I grabbed a handle, allocated new field memory, attached it
to the form, and freed the old field memory, I didn't have that problem (I
could move the focus without a problem). The problem here was, in some
cases, the cursor disappeared and I couldn't get it to re-appear on the
screen. If I started entering characters, it would enter in the correct
field where I set the cursor to, but it wouldn't show the cursor. I figured
this was a pretty unsafe method for changing the text of a field and
changed, but oh boy! what problems.
Any other ideas?
Elia
-----Original Message-----
From: Bob Ebert [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 27, 1999 5:55 PM
To: [EMAIL PROTECTED]
Cc: FORUM
Subject: Re: Focus to a field
At 10:37 PM -0700 5/26/99, Elia J. Freedman wrote:
>I have a problem. I need to control which field on the screen has focus,
>but the PalmOS keeps taking control from me.
> FrmSetFocus(frmP, FrmGetObjectIndex(frmP, ctlID));
> FldGrabFocus(fldP);
The FldGrabFocus line should be redundant. When you call FrmSetFocus, that
routine itself will call FldGrabFocus. It's important to use the Frm call
because the form has a variable that tracks the current focus--necessary so
that the form can tell the field or table to release the focus if the form
loses/changes focus.
If FrmSetFocus isn't working for you, it's probably because you're calling
it at the wrong time. That is, you probably do set the focus to the field,
but then some other bit of code comes along and sets it to something else.
Tracking this down could be tricky, but I think if you set breakpoints in
your event loop and watch the event flow and which Frm calls get made,
you'll find it.
--Bob
_______________________________________________________________________
Bob Ebert, Sr. Software Engineer, Palm Computing Inc., 3Com Corporation
V: 408 326-9299 5400 Bayfront Plaza, MS: 10212, Santa Clara, CA, 95052
F: 408 326-9891, [EMAIL PROTECTED] (preferred: [EMAIL PROTECTED])