Catalog.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Display the catalog and let the user select something
  2. #define USE_TI89 // Compile for TI-89
  3. #define USE_TI92PLUS // Compile for TI-92 Plus
  4. #define USE_V200 // Compile for V200
  5. #define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization
  6. #define MIN_AMS 100 // Compile for AMS 1.00 or higher
  7. #include <tigcclib.h> // Include All Header Files
  8. const char *ptr;
  9. HANDLE handle;
  10. CALLBACK void Handler(EVENT *ev)
  11. {
  12. if (ev->Type == CM_STRING)
  13. ptr = ev->extra.pasteText;
  14. else if (ev->Type == CM_HSTRING)
  15. handle = ev->extra.hPasteText;
  16. ER_throw (1);
  17. }
  18. void _main(void)
  19. {
  20. EVENT ev;
  21. char buffer[100];
  22. ptr = NULL;
  23. handle = H_NULL;
  24. EV_captureEvents (Handler);
  25. CAT_dialog ();
  26. TRY
  27. EV_eventLoop ();
  28. ONERR
  29. EV_captureEvents (NULL);
  30. ENDTRY
  31. if (handle != H_NULL)
  32. ptr = HLock (handle);
  33. if (ptr != NULL)
  34. {
  35. sprintf (buffer, "You selected \"%s\".", ptr);
  36. ST_helpMsg (buffer);
  37. }
  38. else ST_helpMsg ("You pressed ESC.");
  39. if (handle != H_NULL)
  40. HeapFree (handle);
  41. ev.Type = CM_UNFOCUS; // This is more due to some
  42. EV_sendEvent (AP_CURRENT, &ev); // aesthetical reasons
  43. }