Posted By

reboltutorial on 12/11/10


Tagged

rebolsystray


Versions (?)

Systray


 / Published in: R
 

URL: http://rebol.wik.is/Code_Samples/Systray.r

  1. REBOL [
  2. Title: "Systray Example"
  3. File: %systray.r
  4. Purpose: {
  5. Installs a tray icon (Windows only) and then starts a forever loop
  6. }
  7. Date: 28-Nov-2008
  8. Version: 0.0.1
  9. History: [
  10. abstracted from Gabriele's clips.r
  11. ]
  12. ]
  13.  
  14. set-tray: has [menu] [
  15. menu: compose [
  16. restore: "Restore"
  17. bar
  18. quit: "Quit"
  19. ]
  20. set-modes system/ports/system compose/deep/only [
  21. tray: [
  22. add main [
  23. help: "S3Backup"
  24. menu: (menu)
  25. ]
  26. ]
  27. ]
  28. ]
  29.  
  30. system/ports/system/awake: func [port /local msg] [
  31. while [msg: pick port 1] [
  32. if find/match msg [tray main menu] [
  33. msg: last msg
  34. switch/default msg [
  35. restore [
  36. inform layout [
  37. across
  38. vh2 "Title" gold return
  39. btn "Close" [hide-popup]
  40. ]
  41. set-tray
  42. ]
  43. quit [
  44. set-modes port [tray: [remove main]]
  45. quit
  46. ]
  47. ] [
  48. print "an undefined message was received"
  49. ]
  50. ]
  51. ]
  52. false
  53. ]
  54. insert tail system/ports/wait-list system/ports/system
  55. set-tray
  56. forever [
  57. wait 5
  58. print "doing something"
  59. ]

Report this snippet  

You need to login to post a comment.