TaoLib

Check-in [68604e2624]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Removed check for [my widget hull] That function is actually intended to blank out and recreate a hull that may or may not have been destroyed. It's not supposed to return the actual hull (and what it returns is complicated for container/object relationships.)
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:68604e2624f230b02483e623ca2a8103ee4a89fc
User & Date: hypnotoad 2019-01-11 11:14:26
Context
2019-01-11
11:14
Removed check for [my widget hull] That function is actually intended to blank out and recreate a hull that may or may not have been destroyed. It's not supposed to return the actual hull (and what it returns is complicated for container/object relationships.) Leaf check-in: 68604e2624 user: hypnotoad tags: trunk
2019-01-08
00:38
Pulling changes from tcl-8-6-9 and closing that branch check-in: 186d9e47dc user: hypnotoad tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/taotk-form/taotk-form.tcl.

376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
...
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
....
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
....
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
....
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
....
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
....
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
....
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
....
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
....
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
....
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
###
###
# Object which is the vessel for many other objects
# particularly dynamic widgets
###
tool::define ::taotk::meta::form {
  superclass ::tool::ui::form ::taotk::meta::megawidget

  method form::default {f field args} {
    set p $f.$field
    if {[winfo exists $p]} return
    set l $f.$field#l
    set u $f.$field#u

    set subform $method
    set metadata [my meta getnull $subform $field]
    set argsdata [::tool::args_to_options {*}$args]
    dict set formdata subform $method
    dict set formdata field $field
    dict set formdata post_command [namespace code [list my meta set $subform %field% %value%]]
    set value [my meta getnull $subform $field value]

    set objname [my FormObject ::taotk::ui::element.tk $metadata $argsdata $formdata]
    $objname tkdraw $p $value
    $objname tklabel $l [$objname cget label $field] [$objname cget description]
    $objname tklabel $u [$objname cget units]

    grid $l $p $u -sticky news
    grid configure $u -sticky news

    grid configure $l -sticky news
    grid configure $p -padx 2 -sticky news
    grid columnconfigure $f $l -minsize 200
    grid columnconfigure $f $p -minsize 400
    return $objname
  }

  # title: Display a dynamic widget representing an option
  method form::option {f field args} {
    set p $f.$field
................................................................................

    set subform option
    set metadata [my meta getnull $subform $field]
    set argsdata [::tool::args_to_options {*}$args]
    dict set formdata field $field
    dict set formdata post_command [namespace code {my config set %field% %value%}]
    dict set formdata subform $subform

    if {[dict exists $argsdata value]} {
      set value [dict get $argsdata value]
    } else {
      set value [my cget $field]
    }

    set objname [my FormObject ::taotk::ui::element.tk $metadata $argsdata $formdata]
    $objname tkdraw $p $value
    $objname tklabel $l [$objname cget label $field] [$objname cget description]
    $objname tklabel $u [$objname cget units]

    grid $l $p $u -sticky news
    grid configure $u -sticky news

    grid configure $l -sticky news
    grid configure $p -padx 2 -sticky news
    grid columnconfigure $f $l -minsize 200
    grid columnconfigure $f $p -minsize 400
    return $objname
  }

}
###
# END: form.tcl
................................................................................
     # -validatecommand [namespace code {my Validate %P}] \
     # -validate focusout \
     # -invalidcommand [namespace code {my ErrorInvalid %P}]
     # * Does not work at present, consitently returns "Error 1"
     ####
    ttk::button $window.b \
      -text SAVE -style [my Style button small] \
      -command [namespace code {my validate}]
    ttk::button $window.rand \
      -text RAND -style [my Style button small] \
      -command [namespace code {my Validate [::tao::uuid_short]}]
    ttk::button $window.x \
      -text CANCEL -style [my Style button small] \
      -command [namespace code {my Widget_Display}] \
      -balloon {Cancel [Esc]}


    bind $window.m <Key-Return> [namespace code {my validate}]
    bind $window.m <Key-Escape> [namespace code {my Widget_Display}]
    pack $window.x $window.b $window.rand -side right -fill y

    my graft nativewidget $window.m
    pack $window.m -side left -expand 1 -fill x
    focus $window.m
    $window.m icursor end
    #bind $window <Leave> [namespace code {my Widget_Display}]
  }

}
###
# END: string.tcl
###
###
# START: textpopup.tcl
###
................................................................................
    if {[my EnterMode edit window varname]} return
    set readonly [my readonly]
    set label View
    my graft button $window.button
    ::ttk::button $window.button -style [my Style button small [my cget row]] -text $label -command [namespace code {my InvokePopup}]
    grid $window.button -sticky news
 }

  method initialize {} {
    my graft text ::noop
  }

  method InvokePopup {} {
    package require ctext
    set w [my widget subwindow popup]
    destroy $w
    set readonly [my readonly]
    set field [my cget field]

    toplevel $w
    wm title $w [list Editing $field]
    #[winfo toplevel [my organ nativewidget]]
    my graft text $w.t
    ttk::label $w.l -text "Editing $field"
    ctext $w.t -yscrollcommand "$w.vsb set" -xscrollcommand "$w.hsb set" \
      -width 70 -wrap none -font [::taotk::stylesheet cget font-editor]
    ttk::scrollbar $w.vsb -orient vertical -command "$w.t yview"
    ttk::scrollbar $w.hsb -orient horizontal -command "$w.t xview"

    my Highlight
    my <text> delete 0.0 end
    my <text> insert 0.0 [my Value_Display [my Value_Get]]

    ttk::frame $w.b -style [my Style frame]

    ttk::button $w.b.save -text "Save" -command [namespace code {my validate}]
    ttk::button $w.b.close -text "Close" -command "destroy $w"
    ttk::sizegrip $w.b.sizegrip
    if {!$readonly} {
      pack $w.b.save -side left -fill y
    }
    pack $w.b.sizegrip $w.b.close -side right -fill y

    pack $w.l -side top -fill x
    pack $w.b -side bottom -fill x
    pack $w.hsb -side bottom -fill x -padx [list 0 [winfo reqwidth $w.vsb]]

    pack $w.t -side left -fill both -expand 1
    pack $w.vsb -side left -fill y
  }
................................................................................
  option offer_reset {default 0}
  option reset_value {default {}}

  method ApplySelectedValue newvalue {
    set varname [my cget textvariable]
    set $varname $newvalue
  }

  # Implement a subform instance
  method form_edit {tkpath varname fconfig} {
    destroy $tkpath
    set opts [list -textvariable ${varname} -width [my cget width]]
    switch [dict getnull $fconfig type] {
      select {
        ::ttk::combobox $tkpath {*}$opts -values [if_null [dict getnull $fconfig values] [dict getnull $fconfig options]] -state readonly
................................................................................
    foreach key {<Return>} {
      bind [my organ nativewidget] $key [namespace code {my validate}]
    }
    foreach key {<Escape>} {
      bind [my organ nativewidget] $key [namespace code {my <form> display}]
    }
  }

  method Widget_Get {} {
    my variable displayvalue
    set w [my organ nativewidget]
    if {[winfo exists $w]} {
      set displayvalue [$w get]
    }
    return $displayvalue
  }

  method get {} {
    set value [my Widget_Get]
    return $value
  }
}

::taotk::ui::element register vector {
  superclass string ::taotk::meta::form
  meta set const wide_field: 1

  option command {default {}}
  option delimeter {default ", "}

  method SubElement {field tkpath varname args} {
    my variable subobj_map
    set fconfig [dict merge {*}$args]
    set objname [info object namespace [self]]::$field
    dict set fconfig field $field
    dict set fconfig row [my cget row]
    dict set fconfig textvariable $varname
................................................................................
    if {[info command $objname] eq {}} {
      ::taotk::ui::element.vector create $objname
    }
    $objname attach [list form [self]] $fconfig
    $objname form_edit $tkpath $varname $fconfig
    return $objname
  }

  method Widget_Get {} {
    my variable formelement_fields local_array
    set result [array get local_array]
    foreach {obj field} $formelement_fields {
      dict set result $field [$obj get]
    }
    return $result
  }

  method Widget_Edit {} {
    if {[my EnterMode edit window varname]} return
    set subobj_map {}
    set readonly  [my readonly]
    set vectorvar [my varname local_array]
    set labelrow {}
    set widgetrow {}
    set row  [if_null [my cget row] 0]
    ttk::frame $window.m -style [my Style frame]
    foreach {vfield vfieldinfo} [my Vector_Fields] {
      ttk::label $window.m.$vfield#l -style [my stylesheet widget_style label {} $row] -text "$vfield:"
      set subobj [my SubElement $vfield $window.m.$vfield ${vectorvar}($vfield) {widget entry} $vfieldinfo]
      dict set subobj_map $vfield $subobj
      lappend labelrow $window.m.$vfield#l
      lappend widgetrow $window.m.$vfield
    }
    grid {*}$labelrow -sticky news
    grid {*}$widgetrow -sticky news
    pack $window.m

    ttk::button $window.b \
      -text SAVE -style [my Style button small] \
................................................................................
      ttk::button $window.null \
        -text RESET -style [my Style button small] \
        -command [namespace code [list my Widget_Reset_Value]]
        pack $window.x $window.b $window.null -side right -fill y
    } else {
      pack $window.x $window.b -side right -fill y
    }

    my graft nativewidget $window.m
    pack $window.m -side left -expand 1 -fill x
    [lindex $subobj_map 1] widget focus
  }

  method Widget_Reset_Value {} {
    my Validate [my cget reset_value]
    my Widget_Display
    my Value_Display [my cget reset_value]
  }
}

::taotk::ui::element register physics {
  superclass string

  method Widget_Edit {} {
    if {[my EnterMode edit window varname]} return

    if {[string is integer -strict [my cget width]]} {
      lappend opts -width [my cget width]
    }
    destroy {*}[winfo children $window]
................................................................................
      -style [my Style label]
    ttk::entry $window.m -textvariable [my varname user_value] -width 10 \
      -style [my Style entry]

    set options [my cget options]
    ttk::combobox $window.userunit -textvariable [my varname user_units] -width 20 \
      -style [my Style combobox] -values $system_options

    bind $window.userunit [namespace code {my Change_Units}]
     # -validatecommand [namespace code {my Validate %P}] \
     # -validate focusout \
     # -invalidcommand [namespace code {my ErrorInvalid %P}]
     # * Does not work at present, consitently returns "Error 1"
     ####
    ttk::button $window.b \
................................................................................
      ttk::button $window.null \
        -text NULL -style [my Style button small] \
        -command [namespace code {my Widget_Reset_Value}]
        pack $window.x $window.b $window.null -side right -fill y
    } else {
      pack $window.x $window.b -side right -fill y
    }

    my graft nativewidget $window.m
    pack $window.irm $window.m $window.userunit -side left -expand 1 -fill x
    focus $window.m
    $window.m icursor end
  }

  method Widget_Get {} {
................................................................................
      if {![info exists $variable]} {
        set label Create
      } elseif {[set $variable] eq {}} {
        set label Create
      }
    }
    ::ttk::button $p -style [my Style button small] -text $label -command [namespace code {my popup}]

    xylist_window $p $field $array $readonly"

  }

  method popup {} {}
}
###







|





|






|


|








|







 







|





|










|







 







|


|









|






|







 







|










|













|

|





|

|







 







|







 







|








|












|







 







|








|













|
|







 







|




|









|







 







|







 







|







 







|







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
...
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
....
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
....
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
....
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
....
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
....
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
....
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
....
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
....
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
....
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
###
###
# Object which is the vessel for many other objects
# particularly dynamic widgets
###
tool::define ::taotk::meta::form {
  superclass ::tool::ui::form ::taotk::meta::megawidget
  
  method form::default {f field args} {
    set p $f.$field
    if {[winfo exists $p]} return
    set l $f.$field#l
    set u $f.$field#u
    
    set subform $method
    set metadata [my meta getnull $subform $field]
    set argsdata [::tool::args_to_options {*}$args]
    dict set formdata subform $method
    dict set formdata field $field
    dict set formdata post_command [namespace code [list my meta set $subform %field% %value%]]
    set value [my meta getnull $subform $field value] 

    set objname [my FormObject ::taotk::ui::element.tk $metadata $argsdata $formdata]
    $objname tkdraw $p $value   
    $objname tklabel $l [$objname cget label $field] [$objname cget description]
    $objname tklabel $u [$objname cget units]

    grid $l $p $u -sticky news
    grid configure $u -sticky news

    grid configure $l -sticky news
    grid configure $p -padx 2 -sticky news
    grid columnconfigure $f $l -minsize 200 
    grid columnconfigure $f $p -minsize 400
    return $objname
  }

  # title: Display a dynamic widget representing an option
  method form::option {f field args} {
    set p $f.$field
................................................................................

    set subform option
    set metadata [my meta getnull $subform $field]
    set argsdata [::tool::args_to_options {*}$args]
    dict set formdata field $field
    dict set formdata post_command [namespace code {my config set %field% %value%}]
    dict set formdata subform $subform
    
    if {[dict exists $argsdata value]} {
      set value [dict get $argsdata value]
    } else {
      set value [my cget $field]
    }
    
    set objname [my FormObject ::taotk::ui::element.tk $metadata $argsdata $formdata]
    $objname tkdraw $p $value
    $objname tklabel $l [$objname cget label $field] [$objname cget description]
    $objname tklabel $u [$objname cget units]

    grid $l $p $u -sticky news
    grid configure $u -sticky news

    grid configure $l -sticky news
    grid configure $p -padx 2 -sticky news
    grid columnconfigure $f $l -minsize 200 
    grid columnconfigure $f $p -minsize 400
    return $objname
  }

}
###
# END: form.tcl
................................................................................
     # -validatecommand [namespace code {my Validate %P}] \
     # -validate focusout \
     # -invalidcommand [namespace code {my ErrorInvalid %P}]
     # * Does not work at present, consitently returns "Error 1"
     ####
    ttk::button $window.b \
      -text SAVE -style [my Style button small] \
      -command [namespace code {my validate}]    
    ttk::button $window.rand \
      -text RAND -style [my Style button small] \
      -command [namespace code {my Validate [::tao::uuid_short]}] 
    ttk::button $window.x \
      -text CANCEL -style [my Style button small] \
      -command [namespace code {my Widget_Display}] \
      -balloon {Cancel [Esc]}


    bind $window.m <Key-Return> [namespace code {my validate}]
    bind $window.m <Key-Escape> [namespace code {my Widget_Display}]
    pack $window.x $window.b $window.rand -side right -fill y
      
    my graft nativewidget $window.m
    pack $window.m -side left -expand 1 -fill x
    focus $window.m
    $window.m icursor end
    #bind $window <Leave> [namespace code {my Widget_Display}]
  }
  
}
###
# END: string.tcl
###
###
# START: textpopup.tcl
###
................................................................................
    if {[my EnterMode edit window varname]} return
    set readonly [my readonly]
    set label View
    my graft button $window.button
    ::ttk::button $window.button -style [my Style button small [my cget row]] -text $label -command [namespace code {my InvokePopup}]
    grid $window.button -sticky news
 }
 
  method initialize {} {
    my graft text ::noop
  }

  method InvokePopup {} {
    package require ctext
    set w [my widget subwindow popup]
    destroy $w
    set readonly [my readonly]
    set field [my cget field]
 
    toplevel $w
    wm title $w [list Editing $field]
    #[winfo toplevel [my organ nativewidget]]
    my graft text $w.t
    ttk::label $w.l -text "Editing $field"
    ctext $w.t -yscrollcommand "$w.vsb set" -xscrollcommand "$w.hsb set" \
      -width 70 -wrap none -font [::taotk::stylesheet cget font-editor]
    ttk::scrollbar $w.vsb -orient vertical -command "$w.t yview"
    ttk::scrollbar $w.hsb -orient horizontal -command "$w.t xview"

    my Highlight
    my <text> delete 0.0 end
    my <text> insert 0.0 [my Value_Display [my Value_Get]]
    
    ttk::frame $w.b -style [my Style frame]
    
    ttk::button $w.b.save -text "Save" -command [namespace code {my validate}]
    ttk::button $w.b.close -text "Close" -command "destroy $w"
    ttk::sizegrip $w.b.sizegrip
    if {!$readonly} {
      pack $w.b.save -side left -fill y
    } 
    pack $w.b.sizegrip $w.b.close -side right -fill y
  
    pack $w.l -side top -fill x
    pack $w.b -side bottom -fill x
    pack $w.hsb -side bottom -fill x -padx [list 0 [winfo reqwidth $w.vsb]]

    pack $w.t -side left -fill both -expand 1
    pack $w.vsb -side left -fill y
  }
................................................................................
  option offer_reset {default 0}
  option reset_value {default {}}

  method ApplySelectedValue newvalue {
    set varname [my cget textvariable]
    set $varname $newvalue
  }
  
  # Implement a subform instance
  method form_edit {tkpath varname fconfig} {
    destroy $tkpath
    set opts [list -textvariable ${varname} -width [my cget width]]
    switch [dict getnull $fconfig type] {
      select {
        ::ttk::combobox $tkpath {*}$opts -values [if_null [dict getnull $fconfig values] [dict getnull $fconfig options]] -state readonly
................................................................................
    foreach key {<Return>} {
      bind [my organ nativewidget] $key [namespace code {my validate}]
    }
    foreach key {<Escape>} {
      bind [my organ nativewidget] $key [namespace code {my <form> display}]
    }
  }
  
  method Widget_Get {} {
    my variable displayvalue
    set w [my organ nativewidget]
    if {[winfo exists $w]} {
      set displayvalue [$w get]
    }
    return $displayvalue
  }
  
  method get {} {
    set value [my Widget_Get]
    return $value
  }
}

::taotk::ui::element register vector {
  superclass string ::taotk::meta::form
  meta set const wide_field: 1

  option command {default {}}
  option delimeter {default ", "}
  
  method SubElement {field tkpath varname args} {
    my variable subobj_map
    set fconfig [dict merge {*}$args]
    set objname [info object namespace [self]]::$field
    dict set fconfig field $field
    dict set fconfig row [my cget row]
    dict set fconfig textvariable $varname
................................................................................
    if {[info command $objname] eq {}} {
      ::taotk::ui::element.vector create $objname
    }
    $objname attach [list form [self]] $fconfig
    $objname form_edit $tkpath $varname $fconfig
    return $objname
  }
  
  method Widget_Get {} {
    my variable formelement_fields local_array
    set result [array get local_array]
    foreach {obj field} $formelement_fields {
      dict set result $field [$obj get]
    }
    return $result
  }
  
  method Widget_Edit {} {
    if {[my EnterMode edit window varname]} return
    set subobj_map {}
    set readonly  [my readonly]
    set vectorvar [my varname local_array]
    set labelrow {}
    set widgetrow {}
    set row  [if_null [my cget row] 0]
    ttk::frame $window.m -style [my Style frame]
    foreach {vfield vfieldinfo} [my Vector_Fields] {
      ttk::label $window.m.$vfield#l -style [my stylesheet widget_style label {} $row] -text "$vfield:"
      set subobj [my SubElement $vfield $window.m.$vfield ${vectorvar}($vfield) {widget entry} $vfieldinfo]
      dict set subobj_map $vfield $subobj
      lappend labelrow $window.m.$vfield#l 
      lappend widgetrow $window.m.$vfield      
    }
    grid {*}$labelrow -sticky news
    grid {*}$widgetrow -sticky news
    pack $window.m

    ttk::button $window.b \
      -text SAVE -style [my Style button small] \
................................................................................
      ttk::button $window.null \
        -text RESET -style [my Style button small] \
        -command [namespace code [list my Widget_Reset_Value]]
        pack $window.x $window.b $window.null -side right -fill y
    } else {
      pack $window.x $window.b -side right -fill y
    }
      
    my graft nativewidget $window.m
    pack $window.m -side left -expand 1 -fill x
    [lindex $subobj_map 1] widget focus
  }
  
  method Widget_Reset_Value {} {
    my Validate [my cget reset_value]
    my Widget_Display
    my Value_Display [my cget reset_value]
  }
}

::taotk::ui::element register physics {
  superclass string
  
  method Widget_Edit {} {
    if {[my EnterMode edit window varname]} return

    if {[string is integer -strict [my cget width]]} {
      lappend opts -width [my cget width]
    }
    destroy {*}[winfo children $window]
................................................................................
      -style [my Style label]
    ttk::entry $window.m -textvariable [my varname user_value] -width 10 \
      -style [my Style entry]

    set options [my cget options]
    ttk::combobox $window.userunit -textvariable [my varname user_units] -width 20 \
      -style [my Style combobox] -values $system_options
      
    bind $window.userunit [namespace code {my Change_Units}]
     # -validatecommand [namespace code {my Validate %P}] \
     # -validate focusout \
     # -invalidcommand [namespace code {my ErrorInvalid %P}]
     # * Does not work at present, consitently returns "Error 1"
     ####
    ttk::button $window.b \
................................................................................
      ttk::button $window.null \
        -text NULL -style [my Style button small] \
        -command [namespace code {my Widget_Reset_Value}]
        pack $window.x $window.b $window.null -side right -fill y
    } else {
      pack $window.x $window.b -side right -fill y
    }
      
    my graft nativewidget $window.m
    pack $window.irm $window.m $window.userunit -side left -expand 1 -fill x
    focus $window.m
    $window.m icursor end
  }

  method Widget_Get {} {
................................................................................
      if {![info exists $variable]} {
        set label Create
      } elseif {[set $variable] eq {}} {
        set label Create
      }
    }
    ::ttk::button $p -style [my Style button small] -text $label -command [namespace code {my popup}]
    
    xylist_window $p $field $array $readonly"

  }

  method popup {} {}
}
###

Changes to modules/taotk/core/baseclass.tcl.

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    # Destroy our Tk representation
    ###
    my variable tkalias
    set tkWidget {}
    if {[info exists tkalias]} {
      set tkWidget $tkalias
    }
    if {$tkWidget eq {}} {
      set tkWidget [my widget hull]
    }
    if {$tkWidget eq {}} {
      set tkWidget [my organ hull]
    }
    if {$tkWidget ne {}} {
      my Hull_Unbind $tkWidget
    }








<
<
<







147
148
149
150
151
152
153



154
155
156
157
158
159
160
    # Destroy our Tk representation
    ###
    my variable tkalias
    set tkWidget {}
    if {[info exists tkalias]} {
      set tkWidget $tkalias
    }



    if {$tkWidget eq {}} {
      set tkWidget [my organ hull]
    }
    if {$tkWidget ne {}} {
      my Hull_Unbind $tkWidget
    }