At 01:35 PM 8/3/99 -0700, you wrote:
>Hello everyone,
>
>I'm just trying to use a repeat button, and things aren't working properly.
>
>can I just catch the ctlRepeatEvents and use these for my functionality?
>Right now, I'm getting one repeat event, and nothing else...what am I doning
>wrong?
>
>Thanks,
>
>Steve
>
Steve,
ctlRepeatEvent is generated by repeat buttons (and scroll bars) for every
interval (I think its 9/100ths of a second) that the pen remains within the
bounds of the control. If you have multiple repeat buttons, you can check
which one is being tapped by examining the controlID member of the event
structure. Then, you handle each event by updating a label, or doing
whatever it is you need to do on the event. Here's a code snippet from our
book:
MainFormEventHandler (EventPtr eventP)
{
Boolean handled = false;
switch (eventP->eType)
{
case ctlRepeatEvent:
{
FormPtr formP = FrmGetActiveForm ();
handled = MainFormButtonHandler (formP, eventP);
break;
}
default:
{
break;
}
}
return handled;
}
Boolean
MainFormButtonHandler (FormPtr formP, EventPtr eventP)
{
Boolean handled = false;
switch (eventP->data.ctlEnter.controlID)
{
case MainAgeUpRepeating:
{
// Decrement the age
if ( s_Age > 22 )
{
Word wIDAge = FrmGetObjectIndex (formP, MainAgeLabel );
ControlPtr pCtlAge = (ControlPtr) FrmGetObjectPtr (formP, wIDAge);
char szAge[5];
s_Age--;
StrPrintF ( szAge, "%d", s_Age );
FrmHideObject (formP, wIDAge);
FrmCopyLabel (formP, MainAgeLabel, szAge);
FrmShowObject (formP, wIDAge);
}
break;
}
}
return handled;
}
Glenn Bachmann
Bachmann Software and Services, LLC
http://www.bachmannsoftware.com
Software for Handheld & Wireless Computing, Windows and the Internet
Authors of "Palm Programming", published by Macmillan/Sams, and home of
Bachmann Print Manager, the only graphical printing solution for the Palm
Computing Platform