Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | improve twv demos |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d0fc7d3af8eaa6fb83f357e6844e3962 |
User & Date: | chw 2019-06-12 13:05:05.794 |
Context
2019-06-13
| ||
07:46 | fix pkg index template in tclcan check-in: 086eeca314 user: chw tags: trunk | |
2019-06-12
| ||
13:05 | merge with trunk check-in: 6c7a410ba0 user: chw tags: wtf-8-experiment | |
13:05 | improve twv demos check-in: d0fc7d3af8 user: chw tags: trunk | |
12:53 | in tk protect against weird screen dpi values check-in: e54a8ad2b7 user: chw tags: trunk | |
Changes
Changes to undroid/tsb/examples/cheatsheet.tsb.
1 2 3 4 5 6 7 8 9 10 11 12 | 1 {h3 "Taygete Scrap Book Cheat Sheet"} 2 {h4 "Important (internal) global variables"} 3 {table 1 [info global {[A-Z]*}]} 4 {#HTML <dl> <dt><b>ID</b></dt> <dd>The current input field during evaluation, an integer number.</dd> <dt><b>W</b></dt> <dd>The Webview for displaying the page.</dd> <dt><b>H</b></dt> <dd>The history array of input fields, keys are integer numbers starting from 1.</dd> </dl>} 5 {# current state of history array table 2 [array get H]} 6 {h4 "Useful procs in the global namespace"} 7 {info proc *} 8 {#HTML <dl> <dt><code><b>parray</b> arrayname ?pattern?</code></dt> | | > | > | > | > | > > > | > > > | > > | > | > | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1 {h3 "Taygete Scrap Book Cheat Sheet"} 2 {h4 "Important (internal) global variables"} 3 {table 1 [info global {[A-Z]*}]} 4 {#HTML <dl> <dt><b>ID</b></dt> <dd>The current input field during evaluation, an integer number.</dd> <dt><b>W</b></dt> <dd>The Webview for displaying the page.</dd> <dt><b>H</b></dt> <dd>The history array of input fields, keys are integer numbers starting from 1.</dd> </dl>} 5 {# current state of history array table 2 [array get H]} 6 {h4 "Useful procs in the global namespace"} 7 {info proc *} 8 {#HTML <dl> <dt><code><b>parray</b> arrayname ?pattern?</code></dt> <dd>Pretty print an array using <code><b>puts</b></code> and thus outputs after the corresponding input field.</dd><br> <dt><code><b>htmlraw</b> html ?hidden?</code></dt> <dd>Output raw HTML after the corresponding input field, if <code>hidden</code> is true, auto-hide the input field.</dd><br> <dt><code><b>gets</b></code>, <code><b>read</b></code></dt> <dd>Overriden, reading from <code>stdin</code> channel yields empty string.</dd><br> <dt><code><b>puts</b></code></dt> <dd>Overriden, writing to <code>stdout</code>/<code>stderr</code> channels outputs after the corresponding input field.</dd><br> <dt><code><b>h1</b> string</code>, <code><b>h2..h5</b></code></dt> <dd>Format a HTML header after the correspondig input field, auto-hide the input field.</dd><br> <dt><code><b>hr</b></code></dt> <dd>Format a horizontal ruler, auto-hide the input field.</dd><br> <dt><code><b>img</b> ?filename import mime?</code></dt> <dd>Format a HTML IMG given <code>filename</code>, if file name omitted, present file selection. If <code>import</code> is true, the image is inlined. If the mime type of the image is unknown it can be specified with the <code>mime</code> parameter.</dd><br> <dt><code><b>img_from_binary</b> data mime ?hidden?</code></dt> <dd>Format a HTML IMG given the byte array <code>data</code> and mime type <code>mime</code>. If <code>hidden</code> is false, the corresponding input field is not auto-hidden.</dd><br> <dt><code><b>table</b> ncols data</code></dt> <dd>Format a HTML table, <code>ncols</code> gives the number of columns, if negative, use the first <code>-ncols</code> items as header columns.</dd> </dl>} 9 {h4 "Useful procs in the tsb namespace"} 10 {info proc tsb::*} 11 {#HTML <dl> <dt><code><b>tsb::load</b> ?filename?</code></dt> <dd>Load page from given <code>filename</code>, if file name omitted, present file selection.</dd><br> <dt><code><b>tsb::save</b> ?filename?</code></dt> <dd>Save page to given <code>filename</code>, if file name omitted, present file selection.</dd><br> <dt><code><b>tsb::canvas</b> ?-width w -height h?</code></dt> <dd>Creates a <code>canvas</code> emulation implementing enough methods for Plotchart, returns a widget command.</dd><br> <dt><code><b>tsb::canvascmd</b> cmd ...</code></dt> <dd>Implementation of the canvas widget command, supports <code>create</code>, <code>delete</code> and other methods plus method <code>svg</code> which renders the canvas as SVG after the corresponding input field.</dd><br> <dt><code><b>tsb::clear</b></code></dt> <dd>Clears the entire page.</dd><br> <dt><code><b>tsb::eval</b> id</code></dt> <dd>Re-evaluates field with number <code>id</code>.</dd><br> <dt><code><b>tsb::print</b></code></dt> <dd>Opens the print dialog to print the page.</dd> </dl>} 12 {h4 "Input Fields"} 13 {#HTML <p>Input fields have a label of the form <code>in(<number>)</code> where the number is the index in the history array. Arbitraty text can be entered which however should be valid Tcl code, except the very first line is <code>#HTML</code> or <code>#MARKDOWN</code>, in which case the following lines should be valid HTML or Markdown text, respectively. The input field is evaluated when <code><Shift>-<Return></code> is pressed.</p> <p>Depending on the command evaluation the input field is sometimes hidden. A double click on the corresponding output field(s) makes the input field visible and thus editable, again.</p>} 14 {h4 "Output Fields"} 15 {#HTML <p>Each input field has two corresponding output fields which are visible/non-empty depending on context. One output field receives preformatted text, either the result or the error message of a command evaluation. The other output field receives HTML, e.g. for displaying an image or for the <code>#HTML</code> form from the input field.</p>} 16 {tsb::save cheatsheet.tsb} |
Changes to undroid/tsb/tsb.tcl.
|
| | > | 1 2 3 4 5 6 7 8 9 10 11 | # Load webview and other stuff. package require twv package require Markdown # On MacOSX we need Tk early, otherwise crashes occur. if {$tcl_platform(os) eq "Darwin"} { package require Tk } |
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | set n [string first "\n" $str] if {$n > 4} { incr n set str [string range $str $n end] } $::W call Wraw $id $str 1 $::W call Inhide $id 1 set newfield 1 } elseif {[catch {uplevel \#0 $str} ret opts]} { if {[dict get $opts -code] == 4} { # continue $::W call Wclear $id } else { $::W call Werror $id $::errorInfo | > > > > > > > > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | set n [string first "\n" $str] if {$n > 4} { incr n set str [string range $str $n end] } $::W call Wraw $id $str 1 $::W call Inhide $id 1 set newfield 1 } elseif {[string first "#MARKDOWN" $str] == 0} { set n [string first "\n" $str] if {$n > 8} { incr n set str [string range $str $n end] } set str [Markdown::convert $str] $::W call Wraw $id $str 1 $::W call Inhide $id 1 set newfield 1 } elseif {[catch {uplevel \#0 $str} ret opts]} { if {[dict get $opts -code] == 4} { # continue $::W call Wclear $id } else { $::W call Werror $id $::errorInfo |
︙ | ︙ |