Tammy,

Coincidentally, I happen to have put this exact same question to
the list a week or two ago, and received more than one satistfactory
response.

To summarize what turned out to be the case.....

1.      When you call FrmReturnToForm(), there _is_ an event
        which occurs when you return, which is a winEnterEvent.
        But.... danger, danger, warning, warning.
        It turns out that a huge bunch of things cause this
        event to arrive at your original form, and it's
        not at all easy to differentiate them.
        E.g. if you put up an alert, you get a winEnterEvent
        when you return.
        I tried putting up a trace alert when the winEnterEvent
        event occurred, which caused another winEnterEvent event,
        and then I put up the alert again etc.
        I had to do a reset.
        The solution I eventually found was to keep a global
        variable n_win_events, which I set to 0 initially,
        and if this was zero, I would not act.
        But before calling FrmPopupForm(), I would set it to 1,
        and then decrement it when the event occurred.
        In this way, I would know that it was the winEnterEvent
        which occurred after returning from FrmReturnToForm().

        This method works - but it is not at all a clean design.
        It has the advantage that you don't have to issue
        FrmUpdateForm() to the calling form (which requires you
        to know _which_ form called you).
        But it has the disadvantage that you have to set a
        variable saying which form you called with FrmPopupForm().

2.      If you issue FrmUpdateForm() from the called (popped up)
        form, then this message will get back to the calling form.
        But you ahve to know which form called you, and that
        means you have to leave this lying around in a global variable.

        However, if you want to retrieve info from the
        popped-up form, and if you want to initialise this
        data, you will need a global variable or two anyway.
        So you might as well also set a global variable to
        tell the popped-up form where to send the FrmUpdateForm
        call to.

        I then also use the last argument of FrmUpdateForm()
        to tell the calling form which form has just returned
        with the FrmReturnToForm() call.

It's an unfortunate consequence of the lack of contextual
info in form-events that one has to put so much information
into global variables. In 99% of my programming
(apart from microprocessors like the minimalist PIC chip),
I need no more than 1 global variable. But with PalmOS,
one cannot escape having zillions of global variables.
(This is a neutral observation, not necessarily a criticism.
The PalmOS also has many virtues, which is why I haven't
given up on it. When I couldn't get the save-behind
to work properly for FrmReturnToForm() because I
drew fields in the wrong order, I seriously considered
going to windCE...)

So the sad answer is that one has to program as in Fortran-66.
You have to put your calling arguments to a popup-form
in a global place (a common block?), then call the function
(subroutine), and then read the data when you get back.
I try to write re-usable forms (e.g. for setting a time variable),
and that means that you can't just build in the 
pre-determined variable-to-set into the popup-form's code.

My apologies for the byte-count of this e-mail.
Regards,
Alan Kennington.

PS. In regard to the frenetic topic of copy protection,
which should not be re-inflamed, I ended up settling on the
following text for my home screen in some software
I'm writing. The idea is to strike a measured amount of fear
into the mind of the user if their software
does not pass a PGP signature verificiation.
I.e. users should not use hacked version.

    label "Alan Kennington's Nutrition Program." autoid
        at (center 20) font 0
    label "Version 0.2.1." autoid
        at (center prevbottom) font 0
    label "Copyright \251 1999, Alan Kennington." autoid
        at (center prevbottom) font 0
    label "See accompanying Artistic LICENCE." autoid
        at (center prevbottom) font 0
    label "Unauthorized copies" autoid
        at (center prevbottom) font 0
    label "may damage your data." autoid
        at (center prevbottom) font 0
    label "PGP authentication is available at" autoid
        at (center prevbottom) font 0
    label "http://www.topology.org/" autoid
        at (center prevbottom) font 0
    label "src/palm/aknp1/README.html" autoid
        at (center prevbottom) font 0

==========================================================
--------------------------------------------------------------------
   name: Alan Kennington
palmtop: Palm IIIx, PalmOS 3.1
palmdev: gcc/linux (redhat 5.2)
palmsrc: http://topology.org/src/palm/README.html
 e-mail: [EMAIL PROTECTED]
   city: Adelaide, South Australia
 coords: 34.89744 S, 138.58970 E
pgp-key: http://topology.org/key_ak1.html

Reply via email to