Skip to content

Instantly share code, notes, and snippets.

@alterecco
Created July 23, 2010 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alterecco/486829 to your computer and use it in GitHub Desktop.
Save alterecco/486829 to your computer and use it in GitHub Desktop.
dsf screen-identifiers
(block nil
;; a very simple example
(setq screens (lambda nil
(block nil
;; start a new screen
(dsf/new-screen 'screen-one 'standard "Screen One")
(dsf/add-action 'goto-two "Go to Screen 2" 'G '(dsf/show-screen 'screen-two))
(dsf/default-action 'goto-two)
;; start another
(dsf/new-screen 'screen-two 'standard "Screen Two")
(dsf/add-action 'goto-one "Go to Screen 1" 'G '(dsf/show-screen 'screen-one))
(dsf/default-action 'goto-one)
;; show screen one
(dsf/show-screen 'screen-one)
)
))
;; a bit more powerful example, showing the use of screen-identifiers
(setq screens-two (lambda nil
(block nil
;; start a new screen again (this wipes out the old one)
(dsf/new-screen 'screen-one) ; defaults to 'standard screen type
(dsf/name "Screen One")
(dsf/add-action 'goto-two "Go to screen two" 'G '(dsf/show-screen 'screen-two))
(dsf/default-action 'goto-two)
;; start another
(dsf/new-screen 'screen-two 'standard "Screen Two")
(dsf/add-action 'goto-one "Go to Screen 1" 'G '(block nil
(dsf/use-screen 'screen-one) ; the next actions we perform will be on screen-one
(dsf/add-action 'new-action "Go to screen three" 'S '(dsf/show-screen 'screen-three))
(dsf/show-screen 'screen-one) ; we could leave out the screen identifier here
))
(dsf/default-action 'goto-one)
;; screen three
(dsf/new-screen 'screen-three) ; defaults to 'standard screen type
(dsf/name "Screen Three")
(dsf/add-action 'exit "Exit" 'E '(dsf/exit))
(dsf/default-action 'exit)
;; show screen one
(dsf/show-screen 'screen-one)
)
))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment