> I'm not sure about what is the exact problem, could you please try to
> boil this down to a small code snippet? A lot easier for me to fix it
> then.
Yes, I've attached a sample program at the bottom of this note. The program
will display the returned string from aqtGetLastEvent on the AquaTerm
window. However, if you change the "#if 1" to "#if 0", then you'll see that
aqtGetLastEvent always returns an event of 0.
> Is there a particular reason you can't use waitNextEvent?
Yes. I can't use waitNextEvent since that routine blocks. My application
would really be considered a stripcharting application, because it renders
sim data on the fly. Here's pseudocode for my app:
* check if new sim data exists
* if so, read the data and set the redraw_flag
* check if there are any user input events
* if so, process the event and set the redraw_flag
* if redraw_flag, then render a new image
Honestly, this all works fine if I call aqtRenderPlot before checking
events. However, if aqtRenderPlot carries a lot of overhead, I'd hate to
use it more than I have to.
Thanks again for all of your help.
Mike
<-- begin snippet -->
#include <stdio.h>
#include "aquaterm/aquaterm.h"
main()
{
char event[80];
aqtInit();
aqtOpenPlot(1);
aqtSetPlotSize(200, 100);
aqtSetAcceptingEvents(1);
aqtAddLabel("Ready for event...", 100, 50, 0, AQTAlignCenter |
AQTAlignMiddle);
aqtRenderPlot();
while(1)
{
#if 1
aqtRenderPlot();
#endif
aqtGetLastEvent(event);
if (event[0] != '0')
{
aqtEraseRect(0, 0, 200, 100);
aqtAddLabel(event, 100, 50, 0, AQTAlignCenter | AQTAlignMiddle);
aqtRenderPlot();
}
}
}
<-- end snippet -->
|