Well I figured something out, using penUpEvent. You can use your own flavor,
but this is how I did it. It uses a single global variable (could be static
to function) for all the repeating controls (no matter how many). If you
cannot use globals, try either feature memory, or add a hidden control or
gadget to your form, and store the value there. Here is the code snippet of
the form event handler.
static void IncrementControlOne(Int16 amount); // function that gets
called for each ctlRepeatEvent
static void IncrementControlTwo(Int16 amount); // function that gets
called for each ctlRepeatEvent
static void RecalculateForm(); // function that gets called after
user lifts pen. Recalculates all values based on current controls.
static void RedrawForm(); // function that gets called after user
lifts pen. Redraws form.
static UInt16 gRepeatingButtonCounter = 0; // global variable
case ctlRepeatEvent:
{
Int16 amountToAdd = 1;
gRepeatingButtonCounter ++;
if (gRepeatingButtonCounter > 100)
amountToAdd = 10;
if (eventP->data.ctlRepeat.controlID == RepeatOneLeft ||
eventP->data.ctlRepeat.controlID == RepeatOneRight)
{
Int16 increment = eventP->data.ctlRepeat.controlID == RepeatOneLeft ? -1
: 1;
IncrementControlOne(increment * amountToAdd);
}
else if (eventP->data.ctlRepeat.controlID == RepeatTwoLeft ||
eventP->data.ctlRepeat.controlID == RepeatTwoRight)
{
Int16 increment = eventP->data.ctlRepeat.controlID == RepeatTwoLeft ? -1
: 1;
IncrementControlTwo(increment * amountToAdd);
}
break;
}
case penUpEvent:
{
// Since ctlRepeatEvent does not update the display, we have to change it
now
if (gRepeatingButtonCounter != 0)
{
RecalculateForm();
RedrawForm();
gRepeatingButtonCounter = 0;
}
break;
}
LionScribe
"LionScribe" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a repeating control which changes the value of a field, and then
> calls FrmUpdateForm, which when handled, does a fair amount of calculation
> and updates the screen. The problem is that with every repeat event,
> frmUpdateEvent gets handled before the next ctlRepeatEvent, so the form
gets
> continually updated, which causes a drag. I would rather that the
> frmUpdateEvent gets handled after the release of the control. How do I set
> it up, other than using my own event loop.
>
> Also, I would like to know how long the control has been depressed, so
that
> the longer it is held, the program will increment the value quicker. How
do
> I do that? I do not have access to globals while this is happening.
>
> LionScribe
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/