Hi,

a have problem with EvtEventAvail.
I read data from serial port and have Form with Cancel button open.
I want to cancel the reading, when the button is pressed.

I test, if there is an event using EvtEventAvail.
If it is a perform SysHandleEvent and possibly FrmHandleEvent.

Code for the progress function follows.

It works OK on POSE. At real device (m515), it seems, that there is ALWAYS
some event (event.eType == 2)
(Seems like penUp).

How should I solve this problem?

                                                        Rudla

static Err CheckReadProgress(UInt32 bytes_to_now) /*

Purpose:

Serial port PortReadData progress function.

Returns cancel, if the user pushed some button.

*/{

UInt16 event_limit;

UInt8 buffer[100];

EventType event;


StrPrintF(buffer, "S:%ld", bytes_to_now);

WinDrawChars(buffer, StrLen(buffer), 0,12);

event_limit = 5;

while (event_limit-- > 0 && EvtEventAvail()) {

EvtGetEvent(&event, evtWaitForever);


ReportSubmessageInt("Event: %ld", event.eType);


if (event.eType == ctlSelectEvent) {

return ErrUserCancel;

}

if (!SysHandleEvent(&event)) {

FrmDispatchEvent(&event);

}

}

return 0;

}



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to