Class: Variable (Ruby 2.2.2)
Description: Class : Variable - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- tk/lib/tk/variable.rb

### Parent

Object

### 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

Quicksearch

- 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::Encoding
- 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::Text::Peer
- 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
- TkBindCore
- TkBindTag
- TkBindTagAll
- TkBitmapImage
- TkCallbackBreak
- TkCallbackContinue
- TkCallbackEntry
- TkCallbackRedo
- TkCallbackRetry
- TkCallbackReturn
- TkCallbackThrow
- TkCanvasItemConfig
- TkClipboard
- TkComm
- TkComposite
- TkConfigMethod
- 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
- TkTreatFont
- 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
- TkWidget
- 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

No matching classes.

# Variable

### 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) click to toggle source

def ::callback

                   # File tk/lib/tk/variable.rb, line 55
      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
          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
    =end
        else
          ''
        end
      end

new(val="", type=nil) click to toggle source

                   # File tk/lib/tk/variable.rb, line 282
      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

    =begin
        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
    =end
    =begin
        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
      end

new_hash(val = {}) click to toggle source

                   # File tk/lib/tk/variable.rb, line 106
    def self.new_hash(val = {})
      if val.kind_of?(Hash)
        self.new(val)
      else
        fail ArgumentError, 'Hash is expected'
      end
    end

### Public Instance Methods

%(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1229
    def %(other)
      num_or_str(self._value) % other
      #begin
      #  number(self._value) % other
      #rescue
      #  self._value % other
      #end
    end

&(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1183
    def &(other)
      if other.kind_of?(Array)
        self.to_a & other.to_a
      else
        self.to_i & other.to_i
      end
    end

*(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1218
    def *(other)
      num_or_str(self._value) * other
      #begin
      #  number(self._value) * other
      #rescue
      #  self._value * other
      #end
    end

**(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1237
    def **(other)
      number(self._value) ** other
    end

+(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1197
    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

+@() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1176
    def +@
      self.numeric
    end

-(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1211
    def -(other)
      if other.kind_of?(Array)
        self.to_a - other
      else
        number(self._value) - other
      end
    end

-@() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1179
    def -@
      -(self.numeric)
    end

/(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1226
    def /(other)
      number(self._value) / other
    end

<=>(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1283
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1244
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1268
    def ===(other)
      if other.kind_of?(TkVariable)
        self.id == other.id
      else
        super
      end
    end

=~(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1240
    def =~(other)
      self._value =~ other
    end

[](*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 688
    def [](*idxs)
      _to_default_element_type(idxs, _element_value(*idxs))
    end

[]=(*args) click to toggle source

                   # File tk/lib/tk/variable.rb, line 532
    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() click to toggle source

                   # File tk/lib/tk/variable.rb, line 777
      def bool
        TkComm.bool(_value)
    =begin
        # see Tcl_GetBoolean man-page
        case _value.downcase
        when '0', 'false', 'no', 'off'
          false
        else
          true
        end
    =end
      end

bool=(val) click to toggle source
Alias for: set_bool
bool_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 789
    def bool_element(*idxs)
      TkComm.bool(_element_value(*idxs))
    end

bool_type=(val) click to toggle source
Alias for: set_bool_type
clear() click to toggle source

                   # File tk/lib/tk/variable.rb, line 445
    def clear
      if (is_scalar?)
        fail RuntimeError, 'cannot clear a scalar variable'
      end
      keys.each{|k| unset(k)}
      self
    end

coerce(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1159
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 148
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 133
    def default_proc(cmd = Proc.new)
      @def_default = :proc
      @default_val = cmd
      self
    end

default_value(val=nil, &b) click to toggle source

#default_value is available only when the variable is an assoc array.

                   # File tk/lib/tk/variable.rb, line 117
    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

default_value=(val) click to toggle source
Alias for: set_default_value
default_value_type() click to toggle source

                   # File tk/lib/tk/variable.rb, line 145
    def default_value_type
      @type
    end

default_value_type=(type) click to toggle source
Alias for: set_default_value_type
element_lappend(idxs, *elems) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1106
    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(elem_idxs, idx) click to toggle source
Alias for: element_lindex
element_lget_f(elem_idxs, idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1138
    def element_lget_f(elem_idxs, idx)
      number(element_lget(elem_idxs, idx)).to_f
    end

element_lget_i(elem_idxs, idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1131
    def element_lget_i(elem_idxs, idx)
      number(element_lget(elem_idxs, idx)).to_i
    end

element_lindex(elem_idxs, idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1118
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1146
    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_a(*idxs) click to toggle source
Alias for: list_element
element_to_f(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 953
    def element_to_f(*idxs)
      number(_element_value(*idxs)).to_f
    end

element_to_i(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 946
    def element_to_i(*idxs)
      number(_element_value(*idxs)).to_i
    end

element_to_s(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 963
    def element_to_s(*idxs)
      _element_value(*idxs)
    end

element_to_sym(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 999
    def element_to_sym(*idxs)
      _element_value(*idxs).intern
    end

Also aliased as: symbol_element
eventloop_tkwait() click to toggle source

                   # File tk/lib/tk/variable.rb, line 390
    def eventloop_tkwait
      wait(false, true)
    end

eventloop_wait(check_root = false) click to toggle source

                   # File tk/lib/tk/variable.rb, line 381
    def eventloop_wait(check_root = false)
      wait(false, check_root)
    end

exist?(*elems) click to toggle source

                   # File tk/lib/tk/variable.rb, line 417
    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

id() click to toggle source

                   # File tk/lib/tk/variable.rb, line 397
    def id
      @id
    end

inspect() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1154
    def inspect
      #Kernel.format "#<TkVariable: %s>", @id
      '#<TkVariable: ' + @id + '>'
    end

is_hash?() click to toggle source

                   # File tk/lib/tk/variable.rb, line 406
    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

is_scalar?() click to toggle source

                   # File tk/lib/tk/variable.rb, line 413
    def is_scalar?
      ! is_hash?
    end

keys() click to toggle source

                   # File tk/lib/tk/variable.rb, line 429
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1102
    def lappend(*elems)
      tk_call('lappend', @id, *elems)
      self
    end

lget(idx) click to toggle source
Alias for: lindex
lget_f(idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1135
    def lget_f(idx)
      number(lget(idx)).to_f
    end

lget_i(idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1128
    def lget_i(idx)
      number(lget(idx)).to_i
    end

lindex(idx) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1114
    def lindex(idx)
      tk_call('lindex', self._value, idx)
    end

Also aliased as: lget
list() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1029
    def list
      #tk_split_list(value)
      tk_split_simplelist(_value)
    end

Also aliased as: to_a, to_ary
list=(val) click to toggle source
Alias for: set_list
list_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1035
    def list_element(*idxs)
      tk_split_simplelist(_element_value(*idxs))
    end

Also aliased as: element_to_a
list_type=(val) click to toggle source
Alias for: set_list_type
lset(idx, val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1142
    def lset(idx, val)
      tk_call('lset', @id, idx, val)
      self
    end

mutex() click to toggle source

                   # File tk/lib/tk/variable.rb, line 21
    def mutex; @mutex; end

nonzero?() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1279
    def nonzero?
      !(numeric.zero?)
    end

numeric() click to toggle source

                   # File tk/lib/tk/variable.rb, line 732
    def numeric
      number(_value)
    end

numeric=(val) click to toggle source
Alias for: set_numeric
numeric_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 735
    def numeric_element(*idxs)
      number(_element_value(*idxs))
    end

numeric_type=(val) click to toggle source
Alias for: set_numeric_type
numlist() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1040
    def numlist
      list.collect!{|val| number(val)}
    end

numlist=(val) click to toggle source
Alias for: set_numlist
numlist_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1043
    def numlist_element(*idxs)
      list_element(*idxs).collect!{|val| number(val)}
    end

numlist_type=(val) click to toggle source
Alias for: set_numlist_type
procedure() click to toggle source

                   # File tk/lib/tk/variable.rb, line 901
    def procedure
      TkComm.procedure(self._value)
    end

procedure=(cmd) click to toggle source
Alias for: set_procedure
procedure_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 904
    def procedure_element(*idxs)
      TkComm.procedure(_element_value(*idxs))
    end

procedure_type=(cmd) click to toggle source
Alias for: set_procedure_type
ref(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 401
    def ref(*idxs)
      # "#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})"
      TkVarAccess.new("#{@id}(#{idxs.collect{|idx| _get_eval_string(idx)}.join(',')})")
    end

remove(*elems) click to toggle source
Alias for: unset
set_bool(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 792
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 806
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 830
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 824
    def set_bool_type(val)
      @type = :bool
      self.bool=(val)
      self
    end

Also aliased as: bool_type=
set_default_element_value_type(idxs, type) click to toggle source

                   # File tk/lib/tk/variable.rb, line 226
    def set_default_element_value_type(idxs, type)
      _set_default_value_type_core(type, idxs)
      self
    end

set_default_value(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 127
    def set_default_value(val)
      @def_default = :val
      @default_val = val
      self
    end

Also aliased as: default_value=
set_default_value_type(type) click to toggle source

                   # File tk/lib/tk/variable.rb, line 220
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 705
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 722
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1047
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1063
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1087
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1081
    def set_list_type(val)
      @type = :list
      self.list=(val)
      self
    end

Also aliased as: list_type=
set_numeric(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 738
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 750
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 772
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 766
    def set_numeric_type(val)
      @type = :numeric
      self.numeric=(val)
      self
    end

Also aliased as: numeric_type=
set_numlist(val) click to toggle source
Also aliased as: numlist=
Alias for: set_list
set_numlist_element(idxs, val) click to toggle source
Alias for: set_list_element
set_numlist_element_type(idxs, val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1097
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1091
    def set_numlist_type(val)
      @type = :numlist
      self.numlist=(val)
      self
    end

Also aliased as: numlist_type=
set_procedure(cmd) click to toggle source

                   # File tk/lib/tk/variable.rb, line 907
    def set_procedure(cmd)
      self.value = cmd
      self
    end

Also aliased as: procedure=
set_procedure_element(idxs, cmd) click to toggle source

                   # File tk/lib/tk/variable.rb, line 912
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 927
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 921
    def set_procedure_type(cmd)
      @type = :procedure
      self.procedure=(cmd)
      self
    end

Also aliased as: procedure_type=
set_string(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 969
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 975
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 990
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 984
    def set_string_type(val)
      @type = :string
      self.string=(val)
      self
    end

Also aliased as: string_type=
set_symbol(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1003
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1009
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1024
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1018
    def set_symbol_type(val)
      @type = :symbol
      self.value=(val)
      self
    end

Also aliased as: symbol_type=
set_value(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 692
    def set_value(val)
      self.value = val
      self
    end

set_value_type(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 714
    def set_value_type(val)
      self.default_value_type = val.class
      self.value = val
      self
    end

Also aliased as: value_type=
set_variable(var) click to toggle source

                   # File tk/lib/tk/variable.rb, line 842
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 848
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 864
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 857
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 875
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 881
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 896
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 890
    def set_window_type(win)
      @type = :window
      self.window=(win)
      self
    end

Also aliased as: window_type=
size() click to toggle source

                   # File tk/lib/tk/variable.rb, line 440
    def size
      INTERP._invoke_without_enc('global', @id)
      TkComm.number(INTERP._invoke_without_enc('array', 'size', @id))
    end

string() click to toggle source
Alias for: to_s
string=(val) click to toggle source
Alias for: set_string
string_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 966
    def string_element(*idxs)
      _element_value(*idxs)
    end

string_type=(val) click to toggle source
Alias for: set_string_type
symbol() click to toggle source
Alias for: to_sym
symbol=(val) click to toggle source
Alias for: set_symbol
symbol_element(*idxs) click to toggle source
Alias for: element_to_sym
symbol_type=(val) click to toggle source
Alias for: set_symbol_type
thread_tkwait() click to toggle source

                   # File tk/lib/tk/variable.rb, line 393
    def thread_tkwait
      wait(true, true)
    end

thread_wait(check_root = false) click to toggle source

                   # File tk/lib/tk/variable.rb, line 384
    def thread_wait(check_root = false)
      wait(true, check_root)
    end

tkwait(on_thread = true) click to toggle source

                   # File tk/lib/tk/variable.rb, line 387
    def tkwait(on_thread = true)
      wait(on_thread, true)
    end

to_a() click to toggle source
Alias for: list
to_ary() click to toggle source
Alias for: list
to_eval() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1304
    def to_eval
      @id
    end

to_f() click to toggle source

                   # File tk/lib/tk/variable.rb, line 950
    def to_f
      number(_value).to_f
    end

to_hash() click to toggle source

                   # File tk/lib/tk/variable.rb, line 697
    def to_hash
      hash = {}
      self.keys.each{|k|
        hash[k] = self[k]
      }
      hash
    end

to_i() click to toggle source

                   # File tk/lib/tk/variable.rb, line 942
    def to_i
      number(_value).to_i
    end

Also aliased as: to_int
to_int() click to toggle source
Alias for: to_i
to_proc() click to toggle source

                   # File tk/lib/tk/variable.rb, line 932
    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_s() click to toggle source

                   # File tk/lib/tk/variable.rb, line 957
    def to_s
      #string(value).to_s
      _value
    end

Also aliased as: string, to_str
to_str() click to toggle source
Alias for: to_s
to_sym() click to toggle source

                   # File tk/lib/tk/variable.rb, line 995
    def to_sym
      _value.intern
    end

Also aliased as: symbol
trace(opts, cmd = Proc.new) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1377
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1308
    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_delete(opts,cmd) click to toggle source
Alias for: trace_remove
trace_delete_for_element(elem,opts,cmd) click to toggle source
Alias for: trace_remove_for_element
trace_element(elem, opts, cmd = Proc.new) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1417
    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() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1463
    def trace_info
      return [] unless @trace_var
      @trace_var.dup
    end

Also aliased as: trace_vinfo
trace_info_for_element(elem) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1469
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1480
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1560
    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
trace_vdelete(opts,cmd) click to toggle source
Alias for: trace_remove
trace_vdelete_for_element(elem,opts,cmd) click to toggle source
Alias for: trace_remove_for_element
trace_vinfo() click to toggle source
Alias for: trace_info
trace_vinfo_for_element(elem) click to toggle source
Alias for: trace_info_for_element
undef_default() click to toggle source

                   # File tk/lib/tk/variable.rb, line 139
    def undef_default
      @default_val = nil
      @def_default = false
      self
    end

unset(*elems) click to toggle source

                   # File tk/lib/tk/variable.rb, line 544
    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) click to toggle source

                   # File tk/lib/tk/variable.rb, line 453
    def update(hash)
      if (is_scalar?)
        fail RuntimeError, 'cannot update a scalar variable'
      end
      hash.each{|k,v| self[k] = v}
      self
    end

value() click to toggle source

                   # File tk/lib/tk/variable.rb, line 684
    def value
      _to_default_type(_value)
    end

value=(val) click to toggle source

                   # File tk/lib/tk/variable.rb, line 482
      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)
    =begin
          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
    =end
    #      _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

value_type=(val) click to toggle source
Alias for: set_value_type
variable() click to toggle source

                   # File tk/lib/tk/variable.rb, line 835
    def variable
      # keeps a Tcl's variable name
      TkVarAccess.new(self._value)
    end

variable=(var) click to toggle source
Alias for: set_variable
variable_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 839
    def variable_element(*idxs)
      TkVarAccess.new(_element_value(*idxs))
    end

variable_type=(var) click to toggle source
Alias for: set_variable_type
wait(on_thread = false, check_root = false) click to toggle source

                   # File tk/lib/tk/variable.rb, line 362
    def wait(on_thread = false, check_root = false)
      if $SAFE >= 4
        fail SecurityError, "can't wait variable at $SAFE >= 4"
      end
      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

window() click to toggle source

                   # File tk/lib/tk/variable.rb, line 869
    def window
      TkComm.window(self._value)
    end

window=(win) click to toggle source
Alias for: set_window
window_element(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 872
    def window_element(*idxs)
      TkComm.window(_element_value(*idxs))
    end

window_type=(win) click to toggle source
Alias for: set_window_type
zero?() click to toggle source

                   # File tk/lib/tk/variable.rb, line 1276
    def zero?
      numeric.zero?
    end

|(other) click to toggle source

                   # File tk/lib/tk/variable.rb, line 1190
    def |(other)
      if other.kind_of?(Array)
        self.to_a | other.to_a
      else
        self.to_i | other.to_i
      end
    end

### Protected Instance Methods

_element_value(*idxs) click to toggle source

                   # File tk/lib/tk/variable.rb, line 513
    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() click to toggle source

use Tcl function version of set tkvariable

                   # File tk/lib/tk/variable.rb, line 470
    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