Initial commit of newLISP.
[newlisp.git] / guiserver / html-demo.lsp
blob6093d74968f430a7c3029e6451178a44bebeab60
1 #!/usr/bin/newlisp
2 ;;
3 ;; html-demo.lsp - demonstrate the text pane with HTML
5 ;;;; initialization
6 (set-locale "C")
7 (load (append (env "NEWLISPDIR") "/guiserver.lsp"))
9 (gs:init)
11 ;;;; describe the GUI
12 (gs:frame 'HtmlDemo 100 100 400 270 "HTML text-pane demo")
13 (gs:text-pane 'HtmlPane 'htmlpane-action "text/html" 200 500)
14 (gs:set-editable 'HtmlPane nil)
15 (gs:set-tab-size 'HtmlPane 4)
16 (gs:set-font 'HtmlPane "Monospaced" 14 "plain")
17 (gs:set-background 'HtmlPane 1 1 0.96)
19 (if (= ostype "Win32")
20 (set 'url (string "file:///" (env "PROGRAMFILES") "/newlisp/guiserver/html-demo.lsp"))
21 (set 'url "file:///usr/share/newlisp/guiserver/html-demo.lsp")
24 (set 'page (format [text]
25 <html>
26 <center><br><h2>Text panes for HTML</h2></center>
27 <blockquote>
28 <p>This is a page of <i>html</i> text with a clickable hyperlink
29 <a href="%s">html-demo.lsp</a>.</p>
31 <p>The previous link expects the file <tt>html-demo.lsp</tt> in
32 the current directory from where the program was started.</p>
34 <p>Only simple pages are processed correctly.</p>
36 </blockquote>
37 </html>
38 [/text] url))
40 (gs:set-text 'HtmlPane page)
41 (gs:append-text 'HtmlPane "This is appended text")
42 (gs:add-to 'HtmlDemo 'HtmlPane)
43 (gs:set-visible 'HtmlDemo true)
45 ;;;; define actions
46 (define (urlfield-action id txt)
49 (define (htmlpane-action id text)
52 ;;;; listen for incoming action requests and dispatch
53 (gs:listen)
55 ;; eof