This serves as a listener for a button. The result value of the button is returned in the numerical variable.
0: no button was clicked
-1: A right-click occured
>=1: Number of clicked button
If btnwait returns a value of <0 (no button clicked), then you can invoke btnwait again to enter the identical button wait state. But if btnwait returns a value of >=1 (some button pressed), then the images will remain behind, but all button definitions will be cleared (to save memory). Please consult the btndemo/ folder in the SDK for examples.