Dialog Struct.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Dialog structure example
  2. // Example contributed by Sébastien Leurent
  3. #define USE_TI89 // Compile for TI-89
  4. #define USE_TI92PLUS // Compile for TI-92 Plus
  5. #define USE_V200 // Compile for V200
  6. #define OPTIMIZE_ROM_CALLS // Use ROM Call Optimization
  7. #define SET_FILE_IN_USE_BIT // Needed to prevent crashes
  8. #define MIN_AMS 100 // Compile for AMS 1.00 or higher
  9. #include <tigcclib.h> // Include All Header Files
  10. // Main Function
  11. void _main(void)
  12. {
  13. char TxtBuffer[27] = "Hello ";
  14. // 6 bytes "Hello ", max. 20 bytes name, 1 zero byte
  15. #define ItemsNum 3
  16. #define MyStrings "EXAMPLE\0EnterYourName (max. 20 chars)\0Your name"
  17. static SIZED_DIALOG(ItemsNum,offsetof(SIZED_DIALOG(ItemsNum,0),String)) DialogWindow={offsetof(SIZED_DIALOG(ItemsNum,0),String), ItemsNum,130, 50,NoCallBack,
  18. {
  19. {//Title
  20. D_HEADER,DF_SKIP,0,0,{.dHeader={0,BT_OK,BT_CANCEL}}
  21. },
  22. {
  23. D_TEXT,DF_SKIP,3,20,{.dText={sizeof("EXAMPLE")}}
  24. },
  25. {
  26. D_EDIT_FIELD,0, 3, 30,{.dEdit={sizeof("EXAMPLE\0EnterYourName&Age (max. 20 chars)"),6,20,14}}
  27. },
  28. {//End : nothing
  29. .f={}
  30. }
  31. },
  32. MyStrings
  33. };
  34. if (Dialog ((DIALOG *) &DialogWindow, CENTER, CENTER, TxtBuffer, NULL) == KEY_ENTER)
  35. DlgMessage ("GREETINGS", TxtBuffer, BT_OK, BT_NONE);
  36. }