- Ruby - Home
- Ruby - Overview
- Ruby - Environment Setup
- Ruby - Syntax
- Ruby - Classes and Objects
- Ruby - Variables
- Ruby - Operators
- Ruby - Comments
- Ruby - IF...ELSE
- Ruby - Loops
- Ruby - Methods
- Ruby - Blocks
- Ruby - Modules
- Ruby - Strings
- Ruby - Arrays
- Ruby - Hashes
- Ruby - Date & Time
- Ruby - Ranges
- Ruby - Iterators
- Ruby - File I/O
- Ruby - Exceptions
- Ruby - Object Oriented
- Ruby - Regular Expressions
- Ruby - Database Access
- Ruby - Web Applications
- Ruby - Sending Email
- Ruby - Socket Programming
- Ruby - Ruby/XML, XSLT
- Ruby - Web Services
- Ruby - Tk Guide
- Ruby - Ruby/LDAP Tutorial
- Ruby - Multithreading
- Ruby - Built-in Functions
- Ruby - Predefined Variables
- Ruby - Predefined Constants
- Ruby - Associated Tools
- Ruby Useful Resources
- Ruby - Quick Guide
- Ruby - Cheatsheet
- Ruby - Useful Resources
- Ruby - Discussion
- Ruby - Ruby on Rails Tutorial
Ruby/TK - Combobox Widget
Description
A Combobox combines an entry with a list of choices available to the user. This lets them either choose from a set of values you've provided (e.g., typical settings), but also put in their own value.
Syntax
Here is a simple syntax to create this widget −
Tk::BWidget::ComboBox.new(root) {
.....Options....
}
Options
Combobox combines the options related to TkEntry and TkListbox widgets.
Event Bindings
Combobox inherits event bindings from TkEntry and TkListbox widgets.
Examples
require 'tk'
require 'tkextlib/bwidget'
root = TkRoot.new
root.title = "Window"
combobox = Tk::BWidget::ComboBox.new(root)
combobox.values = [1, 2, 3, 4]
combobox.place('height' => 25,
'width' => 100,
'x' => 10,
'y' => 10 )
Tk.mainloop
This will produce the following result −
ruby_tk_guide.htm
Advertisements