Using SET TYPEAHEAD to control the size of the event queue

I Love Xbase++ (ILX)
The portal for Xbase++ developers worldwide

Pat France

New member
Staff member
I am here to help you!
Aug 9, 2022
22
3
3
Customer Identifier
E114627
In a Clipper application, the command SET TYPEAHEAD controls the size of the keyboard buffer. This affects the number of characters that can be held in the buffer used by READ or the Inkey() function.

In a purely event-driven system like Xbase++, there are many more event sources than just the keyboard, and the "keyboard buffer" is, in fact, an event queue associated with the current thread. This queue stores all kinds of events, including keyboard, mouse and notification events generated by user actions.

In Xbase++, SET TYPEAHEAD hence directly affects a thread's ability of caching events until they can be retrieved using AppEvent() or another event function.

In situations where the default limit of 20 events may be exceeded, SET TYPEAHEAD must be increased to ensure proper operation.

Such situations include:
  • inserting large sections of text into the event queue using KEYBOARD, for example, when pasting text from the clipboard
  • using the PostAppEvent() function repeatedly in a manner that causes the event queue to fill up before the thread has a chance to retrieve events using AppEvent()
  • Complex UI scenarios which generate a large number of events which are retrieved at a later time
In these scenarios, SET TYPEAHEAD must be used to enlarge the size of the event queue of the respective thread, for example, to a value of 200.
 
Last edited by a moderator: