## Revisit to Tiny Spreadsheet, using buttons and selp_help windows, Model Vaporware using TCL

### Introduction

gold Here are some cosmetics and supplements on Tiny Spreadsheet or small TCL apps on TCL console. One could probably use a slot calculator 1) window for numeric entries controlling the calculation proc and the 2) graphics display windows. Data transfer in vaporware uses global variables. The slot calculators have 8 slots. The calculation proc supplies N parameters from dummy number calculations to the parametric equations. The calculation proc uses a for loop.

Added buttons and cosmetics below to bottom of file. Added statements for math ops and TCLLIB library. Previous 3 spreadsheet demos cmd'ed from buttons source. Source the tiny_spreadsheet_app_on_wiki.tcl at top of file. Reference the Tiny Spreadsheet on Tiny Excel-like app in plain Tcl/Tk by dbohdan.

### Pseudocode, Equations, and Wiki Page Checklist

```     #pseudocode can be developed from rules of thumb.
#pseudocode: some problems can be solved by proportions (rule of three), to some order of magnitude
#pseudocode: enter quantity1,  quantity2, quantity3 and expected output (quantity4) for testcases.
#pseudocode: enter time in years, number of remaining items
#pseudocode: output fraction of (remaining items) over (items at time zero)
#pseudocode: ouput remaining items as fraction or percent
#pseudocode: output fraction of (quantity4 ) over ( quantity1 at time zero)
#pseudocode: output fraction of (quantity2) * (quantity3 ) over (quantity1 at time zero)
#pseudocode: outputs should be in compatible units.
#pseudocode: rules of thumb can be 3 to 15 percent off, partly since g..in g..out.
#pseudocode: need test cases > small,medium, giant
#pseudocode: need testcases within range of expected operation.
#pseudocode: are there any cases too small or large to be solved?
#
# F(N+1) == F(N) + F(N-1)
# F(1) == 1
# F(2) == 1
set Middle_School 2
set High_School 4
set College 4
set values [list 6 8 12 16 18]
set fractals [list 9.7 12.94 19.4 25.888 29.14]
partials, f(1)= .5
f(2) = (1/4) * .5
f(3) = (1/6) * .5
```

### Testcases Section

In planning any software, it is advisable to gather a number of testcases to check the results of the program.

## Appendix Code

### appendix TCL programs and scripts

```        ;# pretty print from autoindent and ased editor occurrence
;# or small TCL apps on TCL console
;# written on Windows
;# working under TCL version 8.6
;# gold on TCL WIKI, 30apr2021
;# added buttons and cosmetics below to bottom of file
;# added statements for math ops and TCLLIB library
;# previous 3 spreadsheet demos cmd'ed from buttons
package require math::numtheory
package require math::constants
package require math::trig
package require math
namespace path {::tcl::mathop ::tcl::mathfunc math::numtheory math::trig math::constants }
frame .frame -relief flat -bg aquamarine4
frame .buttons -bg aquamarine4
proc self_help {} {
from TCL ,
;# self help listing
;# field names are upper case
;# use mouse to move to cells
;# support for arbitrary expressions (=A1+B2*C3)
;# circular reference prevention
;# automatic persistence
;# Lines are assumed to be up to 100 characters
;# select demos with testcase buttons
;# possible to add more button demos internally
;# demo1; focus -f .cellB2
;# demo2; focus -f .cellB2
;# demo3; focus -f .cellB1
;# add buttons and cosmetics below to bottom of file
;# button report command open console window
;# added statements for math ops and TCLLIB library"
tk_messageBox -title "Self_Help" -message \$msg }
from TCL  "
tk_messageBox -title "About" -message \$msg }
proc clearx {} {
foreach i {1 2 3 4 5 6 7 8 } { break
} }
::ttk::button .calculator -text "Solve" -command {demo1 ;wm title . "Tiny TexTCeL Spreadsheet"     }
::ttk::button .test2 -text "Testcase1" -command {demo1 ;wm title . "Tiny TexTCeL Spreadsheet" }
::ttk::button .test3 -text "Testcase2" -command {demo2 ;wm title . "Tiny TexTCeL Spreadsheet" }
::ttk::button .test4 -text "Testcase3" -command {demo3 ;wm title . "Tiny TexTCeL Spreadsheet" }
::ttk::button .clearallx -text clear -command {clearx }
::ttk::button .self_help -text self_help -command {self_help}
::ttk::button .cons -text report -command { console show }
::ttk::button .exit -text exit -command {exit}
pack  .clearallx .cons .self_help .about .exit .test4 .test3 .test2   -side bottom -in .buttons
grid .frame .buttons -sticky ns -pady {0 10}
. configure -background palegreen -highlightcolor brown -relief raised -border 30
wm title . "Tiny TexTCeL Spreadsheet"
. configure -background palegreen -highlightcolor brown -relief raised -border 30
;# comment # closes auto opening of green console
console show
console eval {.console config -bg palegreen}
console eval {.console config -font {fixed 20 bold}}
console eval {wm geometry . 40x20}
console eval {wm title . "Tiny TexTCeL Spreadsheet Console Output & Self_Help, screen grab and paste from console 2 to texteditor"}
console eval {. configure -background orange -highlightcolor brown -relief raised -border 30}
console eval { proc self_helpx {} {
set msg "in TCL, large black type on green
from TCL,
self help listing
Conventional text editor formulas grabbed
from internet screens can be pasted
into green console
other help on app help button"
tk_messageBox -title "self_helpxx" -message \$msg } }
```

### Pushbutton Operation

For the push buttons, the recommended procedure is push testcase and fill frame, change first three entries etc, push solve, and then push report. Report allows copy and paste from console. For testcases in a computer session, the TCL calculator increments a new testcase number internally, eg. TC(1), TC(2) , TC(3) , TC(N). The testcase number is internal to the calculator and will not be printed until the report button is pushed for the current result numbers. The current result numbers will be cleared either on the next clear button or on the next solve button.

x