Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TkTable Widget within a TabNoteBook

Status
Not open for further replies.

mbitzko

Programmer
Apr 5, 2005
13
US
Thanks to "bong"'s help, I got the TkTable Widget within a tab notebook widget. Now the next problem appeared. When a cell is selected for text entry in the table, a pop up message appears - "Error: can't read "page": no such variable. Any ideas as to why the underlying editor can't find the variable "page"?
=========================================
package require Iwidgets 4.0

source [file join [file dirname [info script]] loadtable.tcl]


# ----------------------------------------------------------------------
# tabnotebook in [incr Widgets]
# ----------------------------------------------------------------------
option add *textBackground seashell
option add *Tabnotebook.backdrop DimGray
option add *Scale.width 8

iwidgets::tabnotebook .tnb \
-width 6i -height 2.90i -tabpos n

set page [.tnb add -label "Spread Sheet Page"]

# -----------------------------------------------------
# Build a frame - bind in the table spreadsheet stuff
# -----------------------------------------------------
frame $page.myFrame -width 20 -height 20 -borderwidth 2 -relief raised
pack $page.myFrame -side top -side bottom -expand true -fill both -pady 4

array set table {
rows 100
cols 9
table .table
}

set t $table(table)

scrollbar $page.myFrame.tsy -command [list $page.myFrame.table yview]
scrollbar $page.myFrame.tsx -command [list $page.myFrame.table xview] -orient horizontal

table $page.myFrame.table \
-rows $table(rows) \
-cols $table(cols) \
-cache 1 \
-titlerows 1 \
-titlecols 1 \
-width 5 -height 5 \
-coltagcommand colorize \
-flashmode on \
-selectmode extended \
-colstretch unset \
-rowstretch unset \
-xscrollcommand { $page.myFrame.tsx set } \
-yscrollcommand { $page.myFrame.tsy set } \
-validate no


pack $page.myFrame.tsy -expand false -fill y -side left -side right
pack $page.myFrame.tsx -expand false -fill x -side top -side bottom
pack $page.myFrame.table -expand true -side top -side bottom -fill both
pack .tnb -expand true -side top -side bottom -fill both
=====================================================
 
It may have to do with the {} in the x and yscrollcommand options. Try using "".

_________________
Bob Rashkin
rrashkin@csc.com
 
Thanks - it works - here is a working template.
================================================
package require Iwidgets 4.0

source [file join [file dirname [info script]] loadtable.tcl]


# ----------------------------------------------------------------------
# tabnotebook in [incr Widgets]
# ----------------------------------------------------------------------
option add *textBackground seashell
option add *Tabnotebook.backdrop DimGray
option add *Scale.width 8

iwidgets::tabnotebook .tnb \
-width 6i -height 2.90i -tabpos n

set page [.tnb add -label "Spread Sheet Page"]

# -----------------------------------------------------
# Build a frame - bind in the table spreadsheet stuff
# -----------------------------------------------------
frame $page.myFrame -width 20 -height 20 -borderwidth 2 -relief raised
pack $page.myFrame -side top -side bottom -expand true -fill both -pady 4

array set table {
rows 100
cols 9
table .table
}

set t $table(table)

scrollbar $page.myFrame.tsy -command [list $page.myFrame.table yview]
scrollbar $page.myFrame.tsx -command [list $page.myFrame.table xview] -orient horizontal

table $page.myFrame.table \
-rows $table(rows) \
-cols $table(cols) \
-cache 1 \
-titlerows 1 \
-titlecols 1 \
-width 5 -height 5 \
-coltagcommand colorize \
-flashmode on \
-selectmode extended \
-colstretch unset \
-rowstretch unset \
-xscrollcommand " $page.myFrame.tsx set " \
-yscrollcommand " $page.myFrame.tsy set " \
-validate no


pack $page.myFrame.tsy -expand false -fill y -side left -side right
pack $page.myFrame.tsx -expand false -fill x -side top -side bottom
pack $page.myFrame.table -expand true -side top -side bottom -fill both
pack .tnb -expand true -side top -side bottom -fill both
===========================================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top