Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Fevent(3) and pendown events
Page 1 of 1

PostPosted: Thu Apr 04, 2002 4:19 pm
by tthkbw
I am using PtoolboxLib 7.3.2. I use resource forms. I use hard buttons and screen buttons to trap events and record times. So I use Fevent(5) to wait for an event.

I notice that on the hardkey events, the event is generated on the down stroke of the button and that repeats occur if the button is held down for a time. Ok. However, when the stylus is used to press a button (defined in a resource form), the event is not generated until the stylus is lifted. I'm sure this is to allow "cancels" by moving the pen outside of the button before lifting it. But I want the down event to record the time. So I put in Fctl(BINDX,&mypenx); and Fctl(BINDY, &mypeny); calls so I would get PENDOWN events from Fevent(). However, Fevent doesn't generate these events when the PENDOWN occurs within the confines of a resource form button. Is there anyway to trap this?



tthkbw

PostPosted: Thu Apr 04, 2002 5:38 pm
by jstadolnik
Use a repeat button instead of a standard button. Then trap the event in the repeat handler (see the REPEAT Fctl command). Be sure to make the repeat handler return -1 to stop the button from issuing further repeat events. You will also have to redraw the button with an FsetState in the handler so that it will look right.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Thu Apr 04, 2002 11:04 pm
by tthkbw
Cool. I did the repeat button thing and it works great! Joe and PtoolboxLib are amazing.

Now, I continue to have lost events. In my repeat handler I do the following:

button_time(int id) {
int tick2;
int w;

#ifdef PROFILE
START_TIME2;
#endif
quick_ticks = ticks();
switch (id) {
case RUN1B:
w = set_string_width(BWIDTH-2,run1_name);
FsetText(RUN1B,substr(run1_name,0,w));
if (running) new_handler(run1_struct);
break;
case RUN2B:
w = set_string_width(BWIDTH-2,run2_name);
FsetText(RUN2B,substr(run2_name,0,w));
if (running) new_handler(run2_struct);
break;
case RUN3B:
w = set_string_width(BWIDTH-2,run3_name);
FsetText(RUN3B,substr(run3_name,0,w));
if (running) new_handler(run3_struct);
break;
case RUN4B:
w = set_string_width(BWIDTH-2,run4_name);
FsetText(RUN4B,substr(run4_name,0,w));
if (running) new_handler(run4_struct);
break;
}
#ifdef PROFILE
END_TIME2;
puts("repeat time: " + tick2 + CR);
#endif
return -1;
}

According to the profiling, this takes about 140 milliseconds on the device. Note that I ma disabling repeat events.

what happens is that if I repeatedly touch the button with the stylus, I can only go so fast and then the button event is missed. Gone forever. If I use AfterBurner to speed up the application, the profiling time goes down and I can press buttons more rapidly without losing events. It is as if events are lost while I am in the repeat handler plus a bit of time.

I guess I would expect PalmOS to have a fifo of events bigger than one. It seems from what i read in their documentation that this is true, but my combination of PtoolboxLib and PocketC doesn't seem to work that way.

It's also interesting that I cannot replicate this problem on the emulator even using a downloaded rom from my device. The emulator reports about 70 milliseconds for the profiling time.

I also not that I can generate repeat events much more rapidly than I can catch tap events--I just don't want to :)

I am using PtoolBoxlib 7.3.2.

Any ideas?


tthkbw

PostPosted: Fri Apr 05, 2002 1:55 am
by jstadolnik
See form caveat #14. If you rip out the puts() calls the event stealing should go away.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
I also not that I can generate repeat events much more rapidly than I can catch tap events--I just don't want to :)
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

If you return a postive number from the repeat handler, that number becomes the delay in 1/100th second to the next repeat event. So you can slow things down if you want.

Joe



The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Fri Apr 05, 2002 12:36 pm
by tthkbw
I #define PROFILE only when I want to see how long things take. The event loss in this case doesn't appear to have anything to do with the puts statements. When PROFILE is not defined, no puts statements are executed (I check the output buffer to be sure) and the event loss is the same.

However, there are text commands executed to update the display. Also CopyRect, rect,and textalign.

The application is a stopwatch, basically. I want one event only for each tap of the button. There are multiple buttons, one for each runner. It is possible, in the current implementation to tap two adjacent buttons quickly enough that the second event is missed. And, of course, that is exactly what users do when recording times in close race.


tthkbw

PostPosted: Sun Apr 07, 2002 4:25 am
by jstadolnik
Contrary to what I previously thought, there appears to be some kind of PocketC wierdness coming into play when repeat handlers have large internal delays. I'll have to talk with Jeremy about this.

As such, the method I described of using repeat buttons to trap events is unreliable and also has some additional undesirable properties.

I'll provide a new Fctl function to capture the initial trigger time on button events. This will be a much cleaner solution.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm