Posted to tcl by tarwich at Thu Sep 13 16:55:01 GMT 2012view raw

  1. set DEV "";
  2.  
  3. proc menu {menuName {args}} {
  4. package require term::interact::menu;
  5. package require term::ansi::code::macros;
  6.  
  7. switch -nocase $menuName {
  8. MAIN {
  9. menu run {
  10. "Build &Options" { menu buildOptions }
  11. "&Build" { puts "Not implemented!"; }
  12. "&Quit" {
  13. puts "User selected Quit. Bye!";
  14. exit 0;
  15. }
  16. }
  17. }
  18. BUILDOPTIONS {
  19. global DEV;
  20.  
  21. menu run {
  22. "--DEV-----" {}
  23. "Developer Folder ($DEV)" {
  24. global DEV;
  25. #set candidates [find -type d -maxdepth 2 "{/,/Applications/*/Contents,~}" "Developer"];
  26. set candidates [list "/Developer" "/Applications/Developer"]
  27. set DEV [choose -caption "Choose a Dev Root" $candidates];
  28. updateCaption "Developer Folder ($DEV)";
  29. }
  30. }
  31. }
  32. RUN { eval runMenu $args; }
  33. default {
  34. fail "Menu '$menuName' not implemented";
  35. }
  36. }
  37. }
  38.  
  39. proc choose {args} {
  40. # This shows a menu with the list and allows the user to select an item, then returns it
  41. }
  42.  
  43. proc runMenu {args} {
  44. # This is where the menu is output and input is chewed upon
  45. }
  46.  
  47. proc updateCaption {args} {}
  48.  
  49. menu MAIN;
  50.  
  51. exit 1;
  52.