In Files
- tk/lib/tk/variable.rb
Parent
Methods
- ::callback
- ::new
- ::new_hash
- #%
- #&
- #*
- #**
- #+
- #+@
- #-
- #-@
- #/
- #<=>
- #==
- #===
- #=~
- #[]
- #[]=
- #_element_value
- #_value
- #bool
- #bool=
- #bool_element
- #bool_type=
- #clear
- #coerce
- #default_element_value_type
- #default_proc
- #default_value
- #default_value=
- #default_value_type
- #default_value_type=
- #element_lappend
- #element_lget
- #element_lget_f
- #element_lget_i
- #element_lindex
- #element_lset
- #element_to_a
- #element_to_f
- #element_to_i
- #element_to_s
- #element_to_sym
- #eventloop_tkwait
- #eventloop_wait
- #exist?
- #id
- #inspect
- #is_hash?
- #is_scalar?
- #keys
- #lappend
- #lget
- #lget_f
- #lget_i
- #lindex
- #list
- #list=
- #list_element
- #list_type=
- #lset
- #mutex
- #nonzero?
- #numeric
- #numeric=
- #numeric_element
- #numeric_type=
- #numlist
- #numlist=
- #numlist_element
- #numlist_type=
- #procedure
- #procedure=
- #procedure_element
- #procedure_type=
- #ref
- #remove
- #set_bool
- #set_bool_element
- #set_bool_element_type
- #set_bool_type
- #set_default_element_value_type
- #set_default_value
- #set_default_value_type
- #set_element_value
- #set_element_value_type
- #set_list
- #set_list_element
- #set_list_element_type
- #set_list_type
- #set_numeric
- #set_numeric_element
- #set_numeric_element_type
- #set_numeric_type
- #set_numlist
- #set_numlist_element
- #set_numlist_element_type
- #set_numlist_type
- #set_procedure
- #set_procedure_element
- #set_procedure_element_type
- #set_procedure_type
- #set_string
- #set_string_element
- #set_string_element_type
- #set_string_type
- #set_symbol
- #set_symbol_element
- #set_symbol_element_type
- #set_symbol_type
- #set_value
- #set_value_type
- #set_variable
- #set_variable_element
- #set_variable_element_type
- #set_variable_type
- #set_window
- #set_window_element
- #set_window_element_type
- #set_window_type
- #size
- #string
- #string=
- #string_element
- #string_type=
- #symbol
- #symbol=
- #symbol_element
- #symbol_type=
- #thread_tkwait
- #thread_wait
- #tkwait
- #to_a
- #to_ary
- #to_eval
- #to_f
- #to_hash
- #to_i
- #to_int
- #to_proc
- #to_s
- #to_str
- #to_sym
- #trace
- #trace_callback
- #trace_delete
- #trace_delete_for_element
- #trace_element
- #trace_info
- #trace_info_for_element
- #trace_remove
- #trace_remove_for_element
- #trace_vdelete
- #trace_vdelete_for_element
- #trace_vinfo
- #trace_vinfo_for_element
- #undef_default
- #unset
- #update
- #value
- #value=
- #value_type=
- #variable
- #variable=
- #variable_element
- #variable_type=
- #wait
- #window
- #window=
- #window_element
- #window_type=
- #zero?
- #|
Included Modules
- Tk
- Comparable
Class/Module Index
- Arc
- Bitmap
- BitmapImage
- Checkbutton
- CloneMenu
- Font
- Grid
- INTERP
- Labelframe
- Line
- MenuButton
- MultiTkIp
- MultiTkIp::Command_Queue
- MultiTkIp::ThreadGroup
- MultiTkIp_OK
- MultiTkIp_PseudoToplevel_Evaluable
- Object
- Object::TkNamedVirtualEvent
- Object::TkSystemMenu
- Object::Ttk
- OptionMenuButton
- Oval
- Pack
- Panedwindow
- PhotoImage
- Place
- Polygon
- Radiobutton
- Rectangle
- RemoteTkIp
- Selection
- Spinbox
- TclTk
- TclTkCallback
- TclTkCommand
- TclTkImage
- TclTkInterpreter
- TclTkIp
- TclTkLib
- TclTkLib::EventFlag
- TclTkLib::RELEASE_TYPE
- TclTkLib::VarAccessFlag
- TclTkLibCommand
- TclTkObject
- TclTkVariable
- TclTkWidget
- TextItem
- Tk
- Tk::BLT
- Tk::BLT::Barchart
- Tk::BLT::Bitmap
- Tk::BLT::Busy
- Tk::BLT::Busy::Shield
- Tk::BLT::Container
- Tk::BLT::CutBuffer
- Tk::BLT::DnD
- Tk::BLT::DragDrop
- Tk::BLT::DragDrop::DnD_Handle
- Tk::BLT::DragDrop::PackageCommand
- Tk::BLT::DragDrop::PackageCommand::ValidateArgs
- Tk::BLT::DragDrop::SiteCommand
- Tk::BLT::DragDrop::SiteCommand::ValidateArgs
- Tk::BLT::DragDrop::Token
- Tk::BLT::EPS
- Tk::BLT::Graph
- Tk::BLT::GraphCommand
- Tk::BLT::Hiertable
- Tk::BLT::Htext
- Tk::BLT::PlotComponent
- Tk::BLT::PlotComponent::Axis
- Tk::BLT::PlotComponent::Bar
- Tk::BLT::PlotComponent::BitmapMarker
- Tk::BLT::PlotComponent::Crosshairs
- Tk::BLT::PlotComponent::Element
- Tk::BLT::PlotComponent::GridLine
- Tk::BLT::PlotComponent::ImageMarker
- Tk::BLT::PlotComponent::Legend
- Tk::BLT::PlotComponent::Line
- Tk::BLT::PlotComponent::LineMarker
- Tk::BLT::PlotComponent::Marker
- Tk::BLT::PlotComponent::OptKeys
- Tk::BLT::PlotComponent::Pen
- Tk::BLT::PlotComponent::PolygonMarker
- Tk::BLT::PlotComponent::Postscript
- Tk::BLT::PlotComponent::TextMarker
- Tk::BLT::PlotComponent::WindowMarker
- Tk::BLT::Printer
- Tk::BLT::Spline
- Tk::BLT::Stripchart
- Tk::BLT::Table
- Tk::BLT::Table::TableContainer
- Tk::BLT::Tabnotebook
- Tk::BLT::Tabnotebook::Tab
- Tk::BLT::Tabset
- Tk::BLT::Tabset::NamedTab
- Tk::BLT::Tabset::Tab
- Tk::BLT::Ted
- Tk::BLT::Tile
- Tk::BLT::Tile::Button
- Tk::BLT::Tile::CheckButton
- Tk::BLT::Tile::Checkbutton
- Tk::BLT::Tile::Frame
- Tk::BLT::Tile::Label
- Tk::BLT::Tile::RadioButton
- Tk::BLT::Tile::Radiobutton
- Tk::BLT::Tile::Scrollbar
- Tk::BLT::Tile::Toplevel
- Tk::BLT::Tree
- Tk::BLT::Tree::Node
- Tk::BLT::Tree::Notify
- Tk::BLT::Tree::Tag
- Tk::BLT::Tree::Trace
- Tk::BLT::Treeview
- Tk::BLT::Treeview::ConfigMethod
- Tk::BLT::Treeview::FindExecFlagValue
- Tk::BLT::Treeview::FindExecFlagValue::ValidateArgs
- Tk::BLT::Treeview::Node
- Tk::BLT::Treeview::OpenCloseCommand
- Tk::BLT::Treeview::OpenCloseCommand::ValidateArgs
- Tk::BLT::Treeview::Tag
- Tk::BLT::Treeview::TagOrID_Methods
- Tk::BLT::Vector
- Tk::BLT::VectorAccess
- Tk::BLT::Watch
- Tk::BLT::WinOp
- Tk::BLT::Winop
- Tk::BWidget
- Tk::BWidget::ArrowButton
- Tk::BWidget::Bitmap
- Tk::BWidget::Button
- Tk::BWidget::ButtonBox
- Tk::BWidget::ComboBox
- Tk::BWidget::Dialog
- Tk::BWidget::DragSite
- Tk::BWidget::DropSite
- Tk::BWidget::DynamicHelp
- Tk::BWidget::Entry
- Tk::BWidget::Label
- Tk::BWidget::LabelEntry
- Tk::BWidget::LabelFrame
- Tk::BWidget::ListBox
- Tk::BWidget::ListBox::Event_for_Items
- Tk::BWidget::ListBox::Item
- Tk::BWidget::MainFrame
- Tk::BWidget::MessageDlg
- Tk::BWidget::NoteBook
- Tk::BWidget::NoteBook::Event_for_Tabs
- Tk::BWidget::PagesManager
- Tk::BWidget::PanedWindow
- Tk::BWidget::PanelFrame
- Tk::BWidget::PasswdDlg
- Tk::BWidget::ProgressBar
- Tk::BWidget::ProgressDlg
- Tk::BWidget::ScrollView
- Tk::BWidget::ScrollableFrame
- Tk::BWidget::ScrolledWindow
- Tk::BWidget::SelectColor
- Tk::BWidget::SelectColor::Dialog
- Tk::BWidget::SelectColor::MenuButton
- Tk::BWidget::SelectColor::Menubutton
- Tk::BWidget::SelectFont
- Tk::BWidget::SelectFont::Dialog
- Tk::BWidget::SelectFont::Toolbar
- Tk::BWidget::Separator
- Tk::BWidget::SpinBox
- Tk::BWidget::StatusBar
- Tk::BWidget::TitleFrame
- Tk::BWidget::Tree
- Tk::BWidget::Tree::Event_for_Items
- Tk::BWidget::Tree::Node
- Tk::BWidget::Widget
- Tk::BinaryString
- Tk::Busy
- Tk::Button
- Tk::Canvas
- Tk::CheckButton
- Tk::Clock
- Tk::EncodedString
- Tk::Entry
- Tk::Frame
- Tk::HTML_Widget
- Tk::HTML_Widget::ClippingWindow
- Tk::ICONS
- Tk::Img
- Tk::Img::BMP
- Tk::Img::DTED
- Tk::Img::GIF
- Tk::Img::ICO
- Tk::Img::JPEG
- Tk::Img::PCX
- Tk::Img::PIXMAP
- Tk::Img::PNG
- Tk::Img::PPM
- Tk::Img::PS
- Tk::Img::Raw
- Tk::Img::SGI
- Tk::Img::SUN
- Tk::Img::TGA
- Tk::Img::TIFF
- Tk::Img::WINDOW
- Tk::Img::XBM
- Tk::Img::XPM
- Tk::Itcl
- Tk::Itcl::ItclObject
- Tk::ItemValidateConfigure
- Tk::Itk
- Tk::Itk::Archetype
- Tk::Itk::Component
- Tk::Itk::Toplevel
- Tk::Itk::Widget
- Tk::Iwidgets
- Tk::Iwidgets::Buttonbox
- Tk::Iwidgets::Calendar
- Tk::Iwidgets::Calendar::CalendarCommand
- Tk::Iwidgets::Calendar::CalendarCommand::ValidateArgs
- Tk::Iwidgets::Canvasprintbox
- Tk::Iwidgets::Canvasprintdialog
- Tk::Iwidgets::Checkbox
- Tk::Iwidgets::Combobox
- Tk::Iwidgets::Dateentry
- Tk::Iwidgets::Datefield
- Tk::Iwidgets::Dialog
- Tk::Iwidgets::Dialogshell
- Tk::Iwidgets::Disjointlistbox
- Tk::Iwidgets::Entryfield
- Tk::Iwidgets::Entryfield::EntryfieldValidate
- Tk::Iwidgets::Entryfield::EntryfieldValidate::ValidateArgs
- Tk::Iwidgets::Extbutton
- Tk::Iwidgets::Extfileselectionbox
- Tk::Iwidgets::Extfileselectiondialog
- Tk::Iwidgets::Feedback
- Tk::Iwidgets::Fileselectionbox
- Tk::Iwidgets::Fileselectiondialog
- Tk::Iwidgets::Finddialog
- Tk::Iwidgets::Hierarchy
- Tk::Iwidgets::Hierarchy::IconCommand
- Tk::Iwidgets::Hierarchy::IconCommand::ValidateArgs
- Tk::Iwidgets::Hierarchy::IndicatorCommand
- Tk::Iwidgets::Hierarchy::IndicatorCommand::ValidateArgs
- Tk::Iwidgets::Hierarchy::QueryCommand
- Tk::Iwidgets::Hierarchy::QueryCommand::ValidateArgs
- Tk::Iwidgets::Hyperhelp
- Tk::Iwidgets::Labeledframe
- Tk::Iwidgets::Labeledwidget
- Tk::Iwidgets::Mainwindow
- Tk::Iwidgets::Menubar
- Tk::Iwidgets::Messagebox
- Tk::Iwidgets::Messagedialog
- Tk::Iwidgets::Notebook
- Tk::Iwidgets::Optionmenu
- Tk::Iwidgets::Panedwindow
- Tk::Iwidgets::Promptdialog
- Tk::Iwidgets::Pushbutton
- Tk::Iwidgets::Radiobox
- Tk::Iwidgets::Scopedobject
- Tk::Iwidgets::Scrolledcanvas
- Tk::Iwidgets::Scrolledframe
- Tk::Iwidgets::Scrolledhtml
- Tk::Iwidgets::Scrolledlistbox
- Tk::Iwidgets::Scrolledtext
- Tk::Iwidgets::Scrolledwidget
- Tk::Iwidgets::Selectionbox
- Tk::Iwidgets::Selectiondialog
- Tk::Iwidgets::Shell
- Tk::Iwidgets::Spindate
- Tk::Iwidgets::Spinint
- Tk::Iwidgets::Spinner
- Tk::Iwidgets::Spinner::EntryfieldValidate
- Tk::Iwidgets::Spinner::EntryfieldValidate::ValidateArgs
- Tk::Iwidgets::Spintime
- Tk::Iwidgets::Tabnotebook
- Tk::Iwidgets::Tabset
- Tk::Iwidgets::Timeentry
- Tk::Iwidgets::Timefield
- Tk::Iwidgets::Toolbar
- Tk::Iwidgets::Watch
- Tk::Label
- Tk::LabelFrame
- Tk::Listbox
- Tk::Mac
- Tk::Mac::IconBitmap
- Tk::MacResource
- Tk::Menu
- Tk::Menu::TkInternalFunction
- Tk::MenuClone
- Tk::Menubutton
- Tk::Message
- Tk::OptionMenubutton
- Tk::OptionMenubutton::OptionMenu
- Tk::OptionObj
- Tk::PanedWindow
- Tk::RadioButton
- Tk::Root
- Tk::Scale
- Tk::Scrollable
- Tk::Scrollbar
- Tk::Spinbox
- Tk::Spinbox::SpinCommand
- Tk::Spinbox::SpinCommand::ValidateArgs
- Tk::SysMenu_Apple
- Tk::SysMenu_Help
- Tk::SysMenu_System
- Tk::SystemMenu
- Tk::TOPLEVEL_ALIASES
- Tk::TclX
- Tk::TclX::XPG3_MsgCat
- Tk::Tcllib
- Tk::Tcllib::Autoscroll
- Tk::Tcllib::CText
- Tk::Tcllib::ChatWidget
- Tk::Tcllib::Crosshair
- Tk::Tcllib::Cursor
- Tk::Tcllib::DateField
- Tk::Tcllib::Datefield
- Tk::Tcllib::Diagrams
- Tk::Tcllib::GetString_Dialog
- Tk::Tcllib::History
- Tk::Tcllib::ICO
- Tk::Tcllib::IP6_Entry
- Tk::Tcllib::IPEntry
- Tk::Tcllib::IPEntry6
- Tk::Tcllib::IP_Entry
- Tk::Tcllib::IP_Entry6
- Tk::Tcllib::KHIM
- Tk::Tcllib::KHIM::Help
- Tk::Tcllib::Ntext
- Tk::Tcllib::Plotchart
- Tk::Tcllib::Plotchart::Barchart
- Tk::Tcllib::Plotchart::Barchart3D
- Tk::Tcllib::Plotchart::Boxplot
- Tk::Tcllib::Plotchart::ChartMethod
- Tk::Tcllib::Plotchart::Ganttchart
- Tk::Tcllib::Plotchart::Histogram
- Tk::Tcllib::Plotchart::HorizontalBarchart
- Tk::Tcllib::Plotchart::IsometricPlot
- Tk::Tcllib::Plotchart::Isometricplot
- Tk::Tcllib::Plotchart::Piechart
- Tk::Tcllib::Plotchart::Plot3D
- Tk::Tcllib::Plotchart::PlotSeries
- Tk::Tcllib::Plotchart::PolarPlot
- Tk::Tcllib::Plotchart::Polarplot
- Tk::Tcllib::Plotchart::Radialchart
- Tk::Tcllib::Plotchart::RibbonChart3D
- Tk::Tcllib::Plotchart::RightAxis
- Tk::Tcllib::Plotchart::Stripchart
- Tk::Tcllib::Plotchart::TXPlot
- Tk::Tcllib::Plotchart::Timechart
- Tk::Tcllib::Plotchart::XLogYPlot
- Tk::Tcllib::Plotchart::XYPlot
- Tk::Tcllib::Style
- Tk::Tcllib::Swaplist_Dialog
- Tk::Tcllib::TableList
- Tk::Tcllib::TableList_Tile
- Tk::Tcllib::Tablelist
- Tk::Tcllib::TablelistItemConfig
- Tk::Tcllib::Tablelist_Tile
- Tk::Tcllib::Tkpiechart
- Tk::Tcllib::Tkpiechart::BoxLabeler
- Tk::Tcllib::Tkpiechart::ConfigMethod
- Tk::Tcllib::Tkpiechart::Label
- Tk::Tcllib::Tkpiechart::PeripheralLabeler
- Tk::Tcllib::Tkpiechart::Pie
- Tk::Tcllib::Tkpiechart::PieChartObj
- Tk::Tcllib::Tkpiechart::Slice
- Tk::Tcllib::Tooltip
- Tk::Tcllib::Validator
- Tk::Tcllib::Widget
- Tk::Tcllib::Widget::Calendar
- Tk::Tcllib::Widget::Canvas_Sqmap
- Tk::Tcllib::Widget::Canvas_Zoom
- Tk::Tcllib::Widget::DateEntry
- Tk::Tcllib::Widget::Dateentry
- Tk::Tcllib::Widget::Dialog
- Tk::Tcllib::Widget::MenuEntry
- Tk::Tcllib::Widget::Menuentry
- Tk::Tcllib::Widget::PanelFrame
- Tk::Tcllib::Widget::Panelframe
- Tk::Tcllib::Widget::Ruler
- Tk::Tcllib::Widget::ScreenRuler
- Tk::Tcllib::Widget::Screenruler
- Tk::Tcllib::Widget::ScrolledWindow
- Tk::Tcllib::Widget::Scrolledwindow
- Tk::Tcllib::Widget::Statusbar
- Tk::Tcllib::Widget::SuperFrame
- Tk::Tcllib::Widget::Toolbar
- Tk::Tcllib::Widget::ToolbarItem
- Tk::Tcllib::Widget::ToolbarItemConfig
- Tk::Text
- Tk::Text::IndexModMethods
- Tk::Text::IndexString
- Tk::Tile
- Tk::Tile::Button
- Tk::Tile::CheckButton
- Tk::Tile::Checkbutton
- Tk::Tile::Combobox
- Tk::Tile::Dialog
- Tk::Tile::Entry
- Tk::Tile::Font
- Tk::Tile::Frame
- Tk::Tile::KeyNav
- Tk::Tile::Label
- Tk::Tile::LabelFrame
- Tk::Tile::Labelframe
- Tk::Tile::MenuButton
- Tk::Tile::Menubutton
- Tk::Tile::Notebook
- Tk::Tile::ParseStyleLayout
- Tk::Tile::Progress
- Tk::Tile::Progressbar
- Tk::Tile::RadioButton
- Tk::Tile::Radiobutton
- Tk::Tile::Scale
- Tk::Tile::Scrollbar
- Tk::Tile::Separator
- Tk::Tile::SizeGrip
- Tk::Tile::Sizegrip
- Tk::Tile::Spinbox
- Tk::Tile::Square
- Tk::Tile::Style
- Tk::Tile::TButton
- Tk::Tile::TCheckButton
- Tk::Tile::TCheckbutton
- Tk::Tile::TCombobox
- Tk::Tile::TEntry
- Tk::Tile::TFrame
- Tk::Tile::TLabel
- Tk::Tile::TLabelFrame
- Tk::Tile::TLabelframe
- Tk::Tile::TMenuButton
- Tk::Tile::TMenubutton
- Tk::Tile::TNotebook
- Tk::Tile::TPaned
- Tk::Tile::TProgress
- Tk::Tile::TProgressbar
- Tk::Tile::TRadioButton
- Tk::Tile::TRadiobutton
- Tk::Tile::TScale
- Tk::Tile::TScrollbar
- Tk::Tile::TSeparator
- Tk::Tile::TSpinbox
- Tk::Tile::TSpinbox::SpinCommand
- Tk::Tile::TSpinbox::SpinCommand::ValidateArgs
- Tk::Tile::TSquare
- Tk::Tile::TileWidget
- Tk::Tile::Treeview
- Tk::Tile::Treeview::Item
- Tk::Tile::Treeview::Root
- Tk::Tile::Treeview::Tag
- Tk::Tile::TreeviewConfig
- Tk::Tile::XScrollbar
- Tk::Tile::YScrollbar
- Tk::TkDND
- Tk::TkDND::DND
- Tk::TkDND::DND_Subst
- Tk::TkDND::Shape
- Tk::TkSystemMenu
- Tk::TkTable
- Tk::TkTable::BrowseCommand
- Tk::TkTable::BrowseCommand::ValidateArgs
- Tk::TkTable::CellCommand
- Tk::TkTable::CellCommand::ValidateArgs
- Tk::TkTable::CellTag
- Tk::TkTable::ConfigMethod
- Tk::TkTable::NamedCellTag
- Tk::TkTable::SelectionCommand
- Tk::TkTable::SelectionCommand::ValidateArgs
- Tk::TkTable::ValidateCommand
- Tk::TkTable::ValidateCommand::ValidateArgs
- Tk::TkTrans
- Tk::Toplevel
- Tk::TreeCtrl
- Tk::TreeCtrl::BindCallback
- Tk::TreeCtrl::BitmapElement
- Tk::TreeCtrl::BorderElement
- Tk::TreeCtrl::Column
- Tk::TreeCtrl::ConfigMethod
- Tk::TreeCtrl::Element
- Tk::TreeCtrl::ImageElement
- Tk::TreeCtrl::Item
- Tk::TreeCtrl::NotifyEvent
- Tk::TreeCtrl::RectangleElement
- Tk::TreeCtrl::Style
- Tk::TreeCtrl_Widget
- Tk::Trofs
- Tk::Ttk
- Tk::UTF8_String
- Tk::ValidateConfigure
- Tk::Vu
- Tk::Vu::Bargraph
- Tk::Vu::ChartsConfig
- Tk::Vu::Dial
- Tk::Vu::NamedPieSlice
- Tk::Vu::Pie
- Tk::Vu::PieSlice
- Tk::Vu::PieSliceConfigMethod
- Tk::Vu::TkcBarchart
- Tk::Vu::TkcSticker
- Tk::Vu::TkcStripchart
- Tk::WinDDE
- Tk::WinRegistry
- Tk::Winico
- Tk::Winico::Winico_callback
- Tk::Winico::Winico_callback::ValidateArgs
- Tk::Wm
- Tk::Wm_for_General
- Tk::XScrollable
- Tk::XScrollbar
- Tk::X_Scrollable
- Tk::YScrollable
- Tk::YScrollbar
- Tk::Y_Scrollable
- TkAfter
- TkBgError
- TkBindTag
- TkBindTagAll
- TkBitmapImage
- TkCallbackBreak
- TkCallbackContinue
- TkCallbackEntry
- TkCallbackRedo
- TkCallbackRetry
- TkCallbackReturn
- TkCallbackThrow
- TkCanvasItemConfig
- TkClipboard
- TkComm
- TkComposite
- TkConsole
- TkCore
- TkCore::Tk_OBJECT_TABLE
- TkDatabaseClass
- TkDialog
- TkDialog2
- TkDialogObj
- TkEvent
- TkEvent::Event
- TkEvent::Event::Grp
- TkEvent::Event::StateMask
- TkEvent::Event::TypeNum
- TkFont
- TkFont::Chooser
- TkFont::CoreMethods
- TkFont::DescendantFont
- TkFont::Fontchooser
- TkGrid
- TkImage
- TkItemConfigMethod
- TkItemConfigOptkeys
- TkItemFontOptkeys
- TkKernel
- TkKinput
- TkListItemConfig
- TkLocalJumpError
- TkManageFocus
- TkMenuEntryConfig
- TkMenuSpec
- TkMenubar
- TkMsgCat
- TkMsgCatalog
- TkNamedFont
- TkNamespace
- TkNamespace::Ensemble
- TkNamespace::NsCode
- TkNamespace::ScopeArgs
- TkObject
- TkOption
- TkOptionDB
- TkOptionDB::Priority
- TkPack
- TkPackage
- TkPalette
- TkPhotoImage
- TkPixmapImage
- TkPlace
- TkRTTimer
- TkResourceDB
- TkScrollbox
- TkSelection
- TkTextImage
- TkTextMark
- TkTextMarkAnchor
- TkTextMarkCurrent
- TkTextMarkInsert
- TkTextNamedMark
- TkTextNamedTag
- TkTextTag
- TkTextTagConfig
- TkTextTagSel
- TkTextWin
- TkTextWindow
- TkTimer
- TkTreatItemFont
- TkTreatTagFont
- TkUtil
- TkUtil::CallbackSubst
- TkUtil::CallbackSubst::Info
- TkValidateCommand
- TkValidateCommand::ValidateArgs
- TkValidation
- TkValidation::ValidateCmd
- TkValidation::ValidateCmd::Action
- TkVarAccess
- TkVariable
- TkVirtualEvent
- TkVirtualEvent::PreDefVirtEvent
- TkVirtualEvent::TkNamedVirtualEvent
- TkWarning
- TkWarning2
- TkWarningObj
- TkWindow
- TkWinfo
- TkXIM
- TkcArc
- TkcBitmap
- TkcGroup
- TkcImage
- TkcItem
- TkcLine
- TkcNamedTag
- TkcOval
- TkcPolygon
- TkcRectangle
- TkcTag
- TkcTagAccess
- TkcTagAll
- TkcTagCurrent
- TkcTagString
- TkcText
- TkcWindow
- TktImage
- TktMark
- TktMarkAnchor
- TktMarkCurrent
- TktMarkInsert
- TktNamedMark
- TktNamedTag
- TktTag
- TktTagSel
- TktWindow
- Variable
- VirtualEvent
- WindowItem
- Winfo
- unknown
TkVariable
Constants
- TkCommandNames
TkCommandNames = ['tkwait'.freeze].freeze
- TkVar_CB_TBL
TkVar_CB_TBL = {} TkVar_ID_TBL = {}
- TkVar_ID_TBL
- Tk_VARIABLE_ID
- USE_OLD_TRACE_OPTION_STYLE
- USE_TCLs_SET_VARIABLE_FUNCTIONS
Public Class Methods
callback(id, name1, name2, op)
def ::callback
# File tk/lib/tk/variable.rb, line 56 def TkVariable.callback(id, name1, name2, op) #name1,name2,op = tk_split_list(args) #name1,name2,op = tk_split_simplelist(args) if cb_obj = TkVar_CB_TBL[id] #_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op)) begin _get_eval_string(cb_obj.trace_callback(name2, op)) rescue SystemExit exit(0) rescue Interrupt exit!(1) rescue Exception => e begin msg = _toUTF8(e.class.inspect) + ': ' + _toUTF8(e.message) + "\n" + "\n---< backtrace of Ruby side >-----\n" + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') else msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception msg = e.class.inspect + ': ' + e.message + "\n" + "\n---< backtrace of Ruby side >-----\n" + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end fail(e, msg) end begin raise 'check backtrace' rescue # ignore backtrace before 'callback' pos = -($!.backtrace.size) end begin _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op)) rescue trace = $!.backtrace raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + "\tfrom #{trace[1..pos].join("\n\tfrom ")}" end else '' end end
new(val="", type=nil)
# File tk/lib/tk/variable.rb, line 283 def initialize(val="", type=nil) # @id = Tk_VARIABLE_ID.join('') begin Tk_VARIABLE_ID.mutex.synchronize{ @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_) Tk_VARIABLE_ID[1].succ! } end until INTERP._invoke_without_enc('info', 'globals', @id).empty? TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL[@id] = self } @var = @id @elem = nil @def_default = false @default_val = nil @trace_var = nil @trace_elem = nil @trace_opts = nil @type = nil var = self @element_type = Hash.new{|k,v| var.default_value_type } self.default_value_type = type # teach Tk-ip that @id is global var INTERP._invoke_without_enc('global', @id) #INTERP._invoke('global', @id) # create and init if val.kind_of?(Hash) # assoc-array variable self[''] = 0 self.clear end self.value = val if val == [] # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) elsif val.kind_of?(Array) a = [] # val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))} # s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"' val.each_with_index{|e,i| a.push(i); a.push(e)} #s = '"' + array2tk_list(a).gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + array2tk_list(a).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' INTERP._eval(format('global %s; array set %s %s', @id, @id, s)) elsif val.kind_of?(Hash) #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ # .gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"' INTERP._eval(format('global %s; array set %s %s', @id, @id, s)) else #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' INTERP._eval(format('global %s; set %s %s', @id, @id, s)) end if val.kind_of?(Hash) #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ # .gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\ .gsub(/[\[\]$"\\]/, '\\\\\&') + '"' INTERP._eval(Kernel.format('global %s; array set %s %s', @id, @id, s)) else #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s)) end end
Public Instance Methods
%(other)
# File tk/lib/tk/variable.rb, line 1227 def %(other) num_or_str(self._value) % other #begin # number(self._value) % other #rescue # self._value % other #end end
&(other)
# File tk/lib/tk/variable.rb, line 1181 def &(other) if other.kind_of?(Array) self.to_a & other.to_a else self.to_i & other.to_i end end
*(other)
# File tk/lib/tk/variable.rb, line 1216 def *(other) num_or_str(self._value) * other #begin # number(self._value) * other #rescue # self._value * other #end end
+(other)
# File tk/lib/tk/variable.rb, line 1195 def +(other) case other when Array self.to_a + other when String self._value + other else begin number(self._value) + other rescue self._value + other.to_s end end end
-(other)
# File tk/lib/tk/variable.rb, line 1209 def -(other) if other.kind_of?(Array) self.to_a - other else number(self._value) - other end end
<=>(other)
# File tk/lib/tk/variable.rb, line 1281 def <=>(other) if other.kind_of?(TkVariable) begin val = other.numeric other = val rescue other = other._value end elsif other.kind_of?(Numeric) begin return self.numeric <=> other rescue return self._value <=> other.to_s end elsif other.kind_of?(Array) return self.list <=> other else return self._value <=> other end end
==(other)
# File tk/lib/tk/variable.rb, line 1242 def ==(other) case other when TkVariable #self.equal?(other) self._value == other._value when String self.to_s == other when Symbol self.to_sym == other when Integer self.to_i == other when Float self.to_f == other when Array self.to_a == other when Hash # false if self is not an assoc array self._value == other else # false self._value == _get_eval_string(other) end end
===(other)
# File tk/lib/tk/variable.rb, line 1266 def ===(other) if other.kind_of?(TkVariable) self.id == other.id else super end end
[](*idxs)
# File tk/lib/tk/variable.rb, line 686 def [](*idxs) _to_default_element_type(idxs, _element_value(*idxs)) end
[]=(*args)
# File tk/lib/tk/variable.rb, line 530 def []=(*args) val = args.pop type = default_element_value_type(args) val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx, true)}.join(',') _fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true))) #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), # _toUTF8(_get_eval_string(val)))) #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), # _get_eval_string(val, true))) end
bool()
# File tk/lib/tk/variable.rb, line 775 def bool TkComm.bool(_value) # see Tcl_GetBoolean man-page case _value.downcase when '0', 'false', 'no', 'off' false else true end end
bool_element(*idxs)
# File tk/lib/tk/variable.rb, line 787 def bool_element(*idxs) TkComm.bool(_element_value(*idxs)) end
clear()
# File tk/lib/tk/variable.rb, line 443 def clear if (is_scalar?) fail RuntimeError, 'cannot clear a scalar variable' end keys.each{|k| unset(k)} self end
coerce(other)
# File tk/lib/tk/variable.rb, line 1157 def coerce(other) case other when TkVariable [other._value, self._value] when String [other, self.to_s] when Symbol [other, self.to_sym] when Numeric [other, self.numeric] when Array [other, self.to_a] else [other, self._value] end end
default_element_value_type(idxs)
# File tk/lib/tk/variable.rb, line 149 def default_element_value_type(idxs) if idxs.kind_of?(Array) index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',') else index = _get_eval_string(idxs, true) end @element_type[index] end
default_proc(cmd = Proc.new)
# File tk/lib/tk/variable.rb, line 134 def default_proc(cmd = Proc.new) @def_default = :proc @default_val = cmd self end
default_value(val=nil, &b)
#default_value is available only when the variable is an assoc array.
# File tk/lib/tk/variable.rb, line 118 def default_value(val=nil, &b) if b @def_default = :proc @default_val = proc(&b) else @def_default = :val @default_val = val end self end
element_lappend(idxs, *elems)
# File tk/lib/tk/variable.rb, line 1104 def element_lappend(idxs, *elems) if idxs.kind_of?(Array) idxs = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',') end tk_call('lappend', "#{@id}(#{idxs})", *elems) self end
element_lget_f(elem_idxs, idx)
# File tk/lib/tk/variable.rb, line 1136 def element_lget_f(elem_idxs, idx) number(element_lget(elem_idxs, idx)).to_f end
element_lget_i(elem_idxs, idx)
# File tk/lib/tk/variable.rb, line 1129 def element_lget_i(elem_idxs, idx) number(element_lget(elem_idxs, idx)).to_i end
element_lindex(elem_idxs, idx)
# File tk/lib/tk/variable.rb, line 1116 def element_lindex(elem_idxs, idx) if elem_idxs.kind_of?(Array) val = _element_value(*elem_idxs) else val = _element_value(elem_idxs) end tk_call('lindex', val, idx) end
Also aliased as: element_lget
element_lset(elem_idxs, idx, val)
# File tk/lib/tk/variable.rb, line 1144 def element_lset(elem_idxs, idx, val) if elem_idxs.kind_of?(Array) idxs = elem_idxs.collect{|i| _get_eval_string(i, true)}.join(',') end tk_call('lset', "#{@id}(#{idxs})", idx, val) self end
element_to_f(*idxs)
# File tk/lib/tk/variable.rb, line 951 def element_to_f(*idxs) number(_element_value(*idxs)).to_f end
element_to_i(*idxs)
# File tk/lib/tk/variable.rb, line 944 def element_to_i(*idxs) number(_element_value(*idxs)).to_i end
element_to_s(*idxs)
# File tk/lib/tk/variable.rb, line 961 def element_to_s(*idxs) _element_value(*idxs) end
element_to_sym(*idxs)
# File tk/lib/tk/variable.rb, line 997 def element_to_sym(*idxs) _element_value(*idxs).intern end
Also aliased as: symbol_element
eventloop_tkwait()
# File tk/lib/tk/variable.rb, line 388 def eventloop_tkwait wait(false, true) end
eventloop_wait(check_root = false)
# File tk/lib/tk/variable.rb, line 379 def eventloop_wait(check_root = false) wait(false, check_root) end
exist?(*elems)
# File tk/lib/tk/variable.rb, line 415 def exist?(*elems) INTERP._invoke_without_enc('global', @id) if elems.empty? TkComm.bool(tk_call('info', 'exist', @id)) else # array index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') TkComm.bool(tk_call('info', 'exist', "#{@id}")) && TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})")) end end
inspect()
# File tk/lib/tk/variable.rb, line 1152 def inspect #Kernel.format "#<TkVariable: %s>", @id '#<TkVariable: ' + @id + '>' end
is_hash?()
# File tk/lib/tk/variable.rb, line 404 def is_hash? #ITNERP._eval("global #{@id}; array exist #{@id}") == '1' INTERP._invoke_without_enc('global', @id) # INTERP._invoke_without_enc('array', 'exist', @id) == '1' TkComm.bool(INTERP._invoke_without_enc('array', 'exist', @id)) end
keys()
# File tk/lib/tk/variable.rb, line 427 def keys if (is_scalar?) fail RuntimeError, 'cannot get keys from a scalar variable' end #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}")) INTERP._invoke_without_enc('global', @id) #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id))) tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), false, true) end
lappend(*elems)
# File tk/lib/tk/variable.rb, line 1100 def lappend(*elems) tk_call('lappend', @id, *elems) self end
lindex(idx)
# File tk/lib/tk/variable.rb, line 1112 def lindex(idx) tk_call('lindex', self._value, idx) end
Also aliased as: lget
list()
# File tk/lib/tk/variable.rb, line 1027 def list #tk_split_list(value) tk_split_simplelist(_value) end
list_element(*idxs)
# File tk/lib/tk/variable.rb, line 1033 def list_element(*idxs) tk_split_simplelist(_element_value(*idxs)) end
Also aliased as: element_to_a
lset(idx, val)
# File tk/lib/tk/variable.rb, line 1140 def lset(idx, val) tk_call('lset', @id, idx, val) self end
numeric_element(*idxs)
# File tk/lib/tk/variable.rb, line 733 def numeric_element(*idxs) number(_element_value(*idxs)) end
numlist_element(*idxs)
# File tk/lib/tk/variable.rb, line 1041 def numlist_element(*idxs) list_element(*idxs).collect!{|val| number(val)} end
procedure_element(*idxs)
# File tk/lib/tk/variable.rb, line 902 def procedure_element(*idxs) TkComm.procedure(_element_value(*idxs)) end
ref(*idxs)
# File tk/lib/tk/variable.rb, line 399 def ref(*idxs) # "#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})" TkVarAccess.new("#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})") end
set_bool(val)
# File tk/lib/tk/variable.rb, line 790 def set_bool(val) if ! val self.value = '0' else case val.to_s.downcase when 'false', '0', 'no', 'off' self.value = '0' else self.value = '1' end end self end
Also aliased as: bool=
set_bool_element(idxs, val)
# File tk/lib/tk/variable.rb, line 804 def set_bool_element(idxs, val) if ! val val = '0' else case val.to_s.downcase when 'false', '0', 'no', 'off' val = '0' else val = '1' end end if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_bool_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 828 def set_bool_element_type(idxs, val) self.set_default_element_value_type(idxs, :bool) self.set_bool_element(idxs, val) end
set_bool_type(val)
# File tk/lib/tk/variable.rb, line 822 def set_bool_type(val) @type = :bool self.bool=(val) self end
Also aliased as: bool_type=
set_default_element_value_type(idxs, type)
# File tk/lib/tk/variable.rb, line 227 def set_default_element_value_type(idxs, type) _set_default_value_type_core(type, idxs) self end
set_default_value(val)
# File tk/lib/tk/variable.rb, line 128 def set_default_value(val) @def_default = :val @default_val = val self end
Also aliased as: default_value=
set_default_value_type(type)
# File tk/lib/tk/variable.rb, line 221 def set_default_value_type(type) _set_default_value_type_core(type, nil) self end
Also aliased as: default_value_type=
set_element_value(idxs, val)
# File tk/lib/tk/variable.rb, line 703 def set_element_value(idxs, val) if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_element_value_type(idxs, val)
# File tk/lib/tk/variable.rb, line 720 def set_element_value_type(idxs, val) self.set_default_element_value_type(idxs, val.class) if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_list(val)
# File tk/lib/tk/variable.rb, line 1045 def set_list(val) case val when Array self.value=(val) when TkVariable self.value=(val.list) else raise ArgumentError, "Array is expected" end self end
Also aliased as: list=, set_numlist
set_list_element(idxs, val)
# File tk/lib/tk/variable.rb, line 1061 def set_list_element(idxs, val) case val when Array val when TkVariable val = val.list else raise ArgumentError, "Array is expected" end if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
Also aliased as: set_numlist_element
set_list_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 1085 def set_list_element_type(idxs, val) self.set_default_element_value_type(idxs, :list) self.set_list_element(idxs, val) end
set_list_type(val)
# File tk/lib/tk/variable.rb, line 1079 def set_list_type(val) @type = :list self.list=(val) self end
Also aliased as: list_type=
set_numeric(val)
# File tk/lib/tk/variable.rb, line 736 def set_numeric(val) case val when Numeric self.value=(val) when TkVariable self.value=(val.numeric) else raise ArgumentError, "Numeric is expected" end self end
Also aliased as: numeric=
set_numeric_element(idxs, val)
# File tk/lib/tk/variable.rb, line 748 def set_numeric_element(idxs, val) case val when Numeric val when TkVariable val = val.numeric else raise ArgumentError, "Numeric is expected" end if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_numeric_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 770 def set_numeric_element_type(idxs, val) self.set_default_element_value_type(idxs, :numeric) self.set_numeric_element(idxs, val) end
set_numeric_type(val)
# File tk/lib/tk/variable.rb, line 764 def set_numeric_type(val) @type = :numeric self.numeric=(val) self end
Also aliased as: numeric_type=
set_numlist_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 1095 def set_numlist_element_type(idxs, val) self.set_default_element_value_type(idxs, :numlist) self.set_numlist_element(idxs, val) end
set_numlist_type(val)
# File tk/lib/tk/variable.rb, line 1089 def set_numlist_type(val) @type = :numlist self.numlist=(val) self end
Also aliased as: numlist_type=
set_procedure(cmd)
# File tk/lib/tk/variable.rb, line 905 def set_procedure(cmd) self.value = cmd self end
Also aliased as: procedure=
set_procedure_element(idxs, cmd)
# File tk/lib/tk/variable.rb, line 910 def set_procedure_element(idxs, cmd) cmd = cmd._value if cmd.kind_of?(TkVariable) if idxs.kind_of?(Array) self[*idxs]=cmd else self[idxs]=cmd end self end
set_procedure_element_type(idxs, cmd)
# File tk/lib/tk/variable.rb, line 925 def set_procedure_element_type(idxs, cmd) self.set_default_element_value_type(idxs, :procedure) self.set_proceure_element(idxs, cmd) end
set_procedure_type(cmd)
# File tk/lib/tk/variable.rb, line 919 def set_procedure_type(cmd) @type = :procedure self.procedure=(cmd) self end
Also aliased as: procedure_type=
set_string(val)
# File tk/lib/tk/variable.rb, line 967 def set_string(val) val = val._value if val.kind_of?(TkVariable) self.value=val self end
Also aliased as: string=
set_string_element(idxs, val)
# File tk/lib/tk/variable.rb, line 973 def set_string_element(idxs, val) val = val._value if val.kind_of?(TkVariable) if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_string_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 988 def set_string_element_type(idxs, val) self.set_default_element_value_type(idxs, :string) self.set_string_element(idxs, val) end
set_string_type(val)
# File tk/lib/tk/variable.rb, line 982 def set_string_type(val) @type = :string self.string=(val) self end
Also aliased as: string_type=
set_symbol(val)
# File tk/lib/tk/variable.rb, line 1001 def set_symbol(val) val = val._value if val.kind_of?(TkVariable) self.value=val self end
Also aliased as: symbol=
set_symbol_element(idxs, val)
# File tk/lib/tk/variable.rb, line 1007 def set_symbol_element(idxs, val) val = val._value if val.kind_of?(TkVariable) if idxs.kind_of?(Array) self[*idxs]=val else self[idxs]=val end self end
set_symbol_element_type(idxs, val)
# File tk/lib/tk/variable.rb, line 1022 def set_symbol_element_type(idxs, val) self.set_default_element_value_type(idxs, :symbol) self.set_symbol_element(idxs, val) end
set_symbol_type(val)
# File tk/lib/tk/variable.rb, line 1016 def set_symbol_type(val) @type = :symbol self.value=(val) self end
Also aliased as: symbol_type=
set_value_type(val)
# File tk/lib/tk/variable.rb, line 712 def set_value_type(val) self.default_value_type = val.class self.value = val self end
Also aliased as: value_type=
set_variable(var)
# File tk/lib/tk/variable.rb, line 840 def set_variable(var) var = var.id if var.kind_of?(TkVariable) self.value = var self end
Also aliased as: variable=
set_variable_element(idxs, var)
# File tk/lib/tk/variable.rb, line 846 def set_variable_element(idxs, var) var = var.id if var.kind_of?(TkVariable) if idxs.kind_of?(Array) self[*idxs]=var else self[idxs]=var end self end
set_variable_element_type(idxs, var)
# File tk/lib/tk/variable.rb, line 862 def set_variable_element_type(idxs, var) self.set_default_element_value_type(idxs, :variable) self.set_variable_element(idxs, var) end
set_variable_type(var)
# File tk/lib/tk/variable.rb, line 855 def set_variable_type(var) @type = :variable var = var.id if var.kind_of?(TkVariable) self.value = var self end
Also aliased as: variable_type=
set_window(win)
# File tk/lib/tk/variable.rb, line 873 def set_window(win) win = win._value if win.kind_of?(TkVariable) self.value = win self end
Also aliased as: window=
set_window_element(idxs, win)
# File tk/lib/tk/variable.rb, line 879 def set_window_element(idxs, win) win = win._value if win.kind_of?(TkVariable) if idxs.kind_of?(Array) self[*idxs]=win else self[idxs]=win end self end
set_window_element_type(idxs, win)
# File tk/lib/tk/variable.rb, line 894 def set_window_element_type(idxs, win) self.set_default_element_value_type(idxs, :window) self.set_window_element(idxs, win) end
set_window_type(win)
# File tk/lib/tk/variable.rb, line 888 def set_window_type(win) @type = :window self.window=(win) self end
Also aliased as: window_type=
size()
# File tk/lib/tk/variable.rb, line 438 def size INTERP._invoke_without_enc('global', @id) TkComm.number(INTERP._invoke_without_enc('array', 'size', @id)) end
string_element(*idxs)
# File tk/lib/tk/variable.rb, line 964 def string_element(*idxs) _element_value(*idxs) end
thread_wait(check_root = false)
# File tk/lib/tk/variable.rb, line 382 def thread_wait(check_root = false) wait(true, check_root) end
tkwait(on_thread = true)
# File tk/lib/tk/variable.rb, line 385 def tkwait(on_thread = true) wait(on_thread, true) end
to_hash()
# File tk/lib/tk/variable.rb, line 695 def to_hash hash = {} self.keys.each{|k| hash[k] = self[k] } hash end
to_i()
# File tk/lib/tk/variable.rb, line 940 def to_i number(_value).to_i end
Also aliased as: to_int
to_proc()
# File tk/lib/tk/variable.rb, line 930 def to_proc cmd = self.procedure if cmd.respond_to?(:call) cmd else # cmd is a String cmd.to_sym.to_proc end end
to_sym()
# File tk/lib/tk/variable.rb, line 993 def to_sym _value.intern end
Also aliased as: symbol
trace(opts, cmd = Proc.new)
# File tk/lib/tk/variable.rb, line 1375 def trace(opts, cmd = Proc.new) opts = _check_trace_opt(opts) (@trace_var ||= []).unshift([opts,cmd]) if @trace_opts == nil TkVar_CB_TBL[@id] = self @trace_opts = opts.dup if USE_OLD_TRACE_OPTION_STYLE Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) else Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts = @trace_opts.dup if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end end self end
trace_callback(elem, op)
# File tk/lib/tk/variable.rb, line 1306 def trace_callback(elem, op) if @trace_var.kind_of? Array @trace_var.each{|m,e| e.call(self,elem,op) if m.index(op)} end if elem.kind_of?(String) && elem != '' if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array) @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)} end end end
trace_element(elem, opts, cmd = Proc.new)
# File tk/lib/tk/variable.rb, line 1415 def trace_element(elem, opts, cmd = Proc.new) if @elem fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end opts = _check_trace_opt(opts) ((@trace_elem ||= {})[elem] ||= []).unshift([opts,cmd]) if @trace_opts == nil TkVar_CB_TBL[@id] = self @trace_opts = opts.dup if USE_OLD_TRACE_OPTION_STYLE Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) else Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts = @trace_opts.dup if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end end self end
trace_info()
# File tk/lib/tk/variable.rb, line 1461 def trace_info return [] unless @trace_var @trace_var.dup end
Also aliased as: trace_vinfo
trace_info_for_element(elem)
# File tk/lib/tk/variable.rb, line 1467 def trace_info_for_element(elem) if @elem fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return [] unless @trace_elem return [] unless @trace_elem[elem] @trace_elem[elem].dup end
Also aliased as: trace_vinfo_for_element
trace_remove(opts,cmd)
# File tk/lib/tk/variable.rb, line 1478 def trace_remove(opts,cmd) return self unless @trace_var.kind_of? Array opts = _check_trace_opt(opts) idx = -1 if USE_OLD_TRACE_OPTION_STYLE newopts = '' @trace_var.each_with_index{|e, i| if idx < 0 && e[1] == cmd diff = false ['a', 'r', 'w', 'u'].each{|c| break if (diff = e[0].index(c) ^ opts.index(c)) } unless diff #find idx = i next end end e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } else newopts = [] @trace_var.each_with_index{|e, i| if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i next end newopts |= e[0] } end if idx >= 0 @trace_var.delete_at(idx) else return self end (@trace_elem ||= {}).each{|elem| @trace_elem[elem].each{|e| if USE_OLD_TRACE_OPTION_STYLE e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} else newopts |= e[0] end } } if USE_OLD_TRACE_OPTION_STYLE diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end end self end
Also aliased as: trace_delete, trace_vdelete
trace_remove_for_element(elem,opts,cmd)
# File tk/lib/tk/variable.rb, line 1558 def trace_remove_for_element(elem,opts,cmd) if @elem fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return self unless @trace_elem.kind_of? Hash return self unless @trace_elem[elem].kind_of? Array opts = _check_trace_opt(opts) idx = -1 if USE_OLD_TRACE_OPTION_STYLE @trace_elem[elem].each_with_index{|e, i| if idx < 0 && e[1] == cmd diff = false ['a', 'r', 'w', 'u'].each{|c| break if (diff = e[0].index(c) ^ opts.index(c)) } unless diff #find idx = i next end end } else @trace_elem[elem].each_with_index{|e, i| if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i next end } end if idx >= 0 @trace_elem[elem].delete_at(idx) else return self end if USE_OLD_TRACE_OPTION_STYLE newopts = '' @trace_var.each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } @trace_elem.each{|elem| @trace_elem[elem].each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } } else newopts = [] @trace_var.each{|e| newopts |= e[0] } @trace_elem.each{|elem| @trace_elem[elem].each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } } end if USE_OLD_TRACE_OPTION_STYLE diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end end self end
Also aliased as: trace_delete_for_element, trace_vdelete_for_element
undef_default()
# File tk/lib/tk/variable.rb, line 140 def undef_default @default_val = nil @def_default = false self end
unset(*elems)
# File tk/lib/tk/variable.rb, line 542 def unset(*elems) if elems.empty? INTERP._unset_global_var(@id) else index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') INTERP._unset_global_var2(@id, index) end end
Also aliased as: remove, remove
update(hash)
# File tk/lib/tk/variable.rb, line 451 def update(hash) if (is_scalar?) fail RuntimeError, 'cannot update a scalar variable' end hash.each{|k,v| self[k] = v} self end
value=(val)
# File tk/lib/tk/variable.rb, line 480 def value=(val) val = val._value if !@type && @type != :variable && val.kind_of?(TkVariable) if val.kind_of?(Hash) self.clear val.each{|k, v| #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), # _toUTF8(_get_eval_string(v))) INTERP._set_global_var2(@id, _get_eval_string(k, true), _get_eval_string(v, true)) } self.value # elsif val.kind_of?(Array) INTERP._set_global_var(@id, '') val.each{|v| #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)), INTERP._set_variable(@id, _get_eval_string(v, true), TclTkLib::VarAccessFlag::GLOBAL_ONLY | TclTkLib::VarAccessFlag::LEAVE_ERR_MSG | TclTkLib::VarAccessFlag::APPEND_VALUE | TclTkLib::VarAccessFlag::LIST_ELEMENT) } self.value # _fromUTF8(INTERP._set_global_var(@id, array2tk_list(val, true))) else #_fromUTF8(INTERP._set_global_var(@id, _toUTF8(_get_eval_string(val)))) _fromUTF8(INTERP._set_global_var(@id, _get_eval_string(val, true))) end end
variable()
# File tk/lib/tk/variable.rb, line 833 def variable # keeps a Tcl's variable name TkVarAccess.new(self._value) end
variable_element(*idxs)
# File tk/lib/tk/variable.rb, line 837 def variable_element(*idxs) TkVarAccess.new(_element_value(*idxs)) end
wait(on_thread = false, check_root = false)
# File tk/lib/tk/variable.rb, line 363 def wait(on_thread = false, check_root = false) on_thread &= (Thread.list.size != 1) if on_thread if check_root INTERP._thread_tkwait('variable', @id) else INTERP._thread_vwait(@id) end else if check_root INTERP._invoke_without_enc('tkwait', 'variable', @id) else INTERP._invoke_without_enc('vwait', @id) end end end
Protected Instance Methods
_element_value(*idxs)
# File tk/lib/tk/variable.rb, line 511 def _element_value(*idxs) index = idxs.collect{|idx| _get_eval_string(idx, true)}.join(',') begin _fromUTF8(INTERP._get_global_var2(@id, index)) rescue => e case @def_default when :proc @default_val.call(self, *idxs) when :val @default_val else fail e end end #_fromUTF8(INTERP._get_global_var2(@id, index)) #_fromUTF8(INTERP._get_global_var2(@id, _toUTF8(_get_eval_string(index)))) #_fromUTF8(INTERP._get_global_var2(@id, _get_eval_string(index, true))) end
_value()
use Tcl function version of set tkvariable
# File tk/lib/tk/variable.rb, line 468 def _value #if INTERP._eval("global #{@id}; array exist #{@id}") == '1' INTERP._invoke_without_enc('global', @id) # if INTERP._invoke('array', 'exist', @id) == '1' if TkComm.bool(INTERP._invoke('array', 'exist', @id)) #Hash[*tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))] Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', @id))] else _fromUTF8(INTERP._get_global_var(@id)) end end