rbcurse 0.1.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +126 -0
- data/Manifest.txt +53 -20
- data/README.markdown +423 -0
- data/Rakefile +3 -1
- data/examples/keytest.rb +177 -0
- data/examples/mpad2.rb +156 -0
- data/examples/newtesttabp.rb +121 -0
- data/examples/rfe.rb +48 -10
- data/examples/rfe_renderer.rb +4 -4
- data/examples/rvimsplit.rb +376 -0
- data/examples/sqlc.rb +97 -106
- data/examples/sqlm.rb +446 -0
- data/examples/test1.rb +4 -4
- data/examples/test2.rb +12 -12
- data/examples/testchars.rb +140 -0
- data/examples/testkeypress.rb +9 -4
- data/examples/testmulticomp.rb +72 -0
- data/examples/testscroller.rb +136 -0
- data/examples/testscrolllb.rb +86 -0
- data/examples/testscrollp.rb +87 -0
- data/examples/testscrollta.rb +80 -0
- data/examples/testscrolltable.rb +166 -0
- data/examples/testsplit.rb +87 -0
- data/examples/testsplit2.rb +123 -0
- data/examples/testsplit3.rb +215 -0
- data/examples/testsplit3_1.rb +244 -0
- data/examples/testsplit3a.rb +215 -0
- data/examples/testsplit3b.rb +237 -0
- data/examples/testsplitta.rb +148 -0
- data/examples/testsplittv.rb +142 -0
- data/examples/testsplittvv.rb +144 -0
- data/examples/testtable.rb +1 -1
- data/examples/testtabp.rb +3 -2
- data/examples/testtestw.rb +69 -0
- data/examples/testtodo.rb +5 -3
- data/examples/testtpane.rb +203 -0
- data/examples/testtpane2.rb +145 -0
- data/examples/testtpanetable.rb +199 -0
- data/examples/viewtodo.rb +5 -3
- data/lib/rbcurse.rb +1 -1
- data/lib/rbcurse/celleditor.rb +2 -2
- data/lib/rbcurse/colormap.rb +5 -5
- data/lib/rbcurse/defaultlistselectionmodel.rb +3 -3
- data/lib/rbcurse/io.rb +663 -0
- data/lib/rbcurse/listeditable.rb +306 -0
- data/lib/rbcurse/listkeys.rb +15 -15
- data/lib/rbcurse/listscrollable.rb +168 -27
- data/lib/rbcurse/mapper.rb +35 -13
- data/lib/rbcurse/rchangeevent.rb +28 -0
- data/lib/rbcurse/rform.rb +845 -0
- data/lib/rbcurse/rlistbox.rb +144 -34
- data/lib/rbcurse/rmessagebox.rb +10 -5
- data/lib/rbcurse/rmulticontainer.rb +325 -0
- data/lib/rbcurse/rmultitextview.rb +306 -0
- data/lib/rbcurse/rscrollform.rb +369 -0
- data/lib/rbcurse/rscrollpane.rb +511 -0
- data/lib/rbcurse/rsplitpane.rb +820 -0
- data/lib/rbcurse/rtabbedpane.rb +737 -109
- data/lib/rbcurse/rtabbedwindow.rb +326 -0
- data/lib/rbcurse/rtable.rb +220 -64
- data/lib/rbcurse/rtextarea.rb +340 -181
- data/lib/rbcurse/rtextview.rb +237 -101
- data/lib/rbcurse/rviewport.rb +203 -0
- data/lib/rbcurse/rwidget.rb +919 -95
- data/lib/rbcurse/scrollable.rb +7 -7
- data/lib/rbcurse/selectable.rb +4 -4
- data/lib/rbcurse/table/tablecellrenderer.rb +3 -0
- data/lib/rbcurse/undomanager.rb +181 -0
- data/lib/rbcurse/vieditable.rb +100 -0
- data/lib/ver/window.rb +471 -21
- metadata +66 -22
- data/README.txt +0 -312
- data/examples/testd.db +0 -0
- data/examples/todocsv.csv +0 -28
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbcurse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Kumar
|
@@ -9,9 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-04-24 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rubyforge
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.4
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: hoe
|
17
27
|
type: :development
|
@@ -20,7 +30,7 @@ dependencies:
|
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
33
|
+
version: 2.6.0
|
24
34
|
version:
|
25
35
|
description: Ruby curses widgets for easy application development
|
26
36
|
email: sentinel.2001@gmx.com
|
@@ -31,29 +41,12 @@ extensions: []
|
|
31
41
|
extra_rdoc_files:
|
32
42
|
- History.txt
|
33
43
|
- Manifest.txt
|
34
|
-
- README.txt
|
35
44
|
files:
|
36
45
|
- CHANGELOG
|
37
46
|
- History.txt
|
38
47
|
- Manifest.txt
|
39
|
-
- README.
|
48
|
+
- README.markdown
|
40
49
|
- Rakefile
|
41
|
-
- examples/qdfilechooser.rb
|
42
|
-
- examples/rfe.rb
|
43
|
-
- examples/rfe_renderer.rb
|
44
|
-
- examples/sqlc.rb
|
45
|
-
- examples/test1.rb
|
46
|
-
- examples/test2.rb
|
47
|
-
- examples/testcombo.rb
|
48
|
-
- examples/testd.db
|
49
|
-
- examples/testkeypress.rb
|
50
|
-
- examples/testmenu.rb
|
51
|
-
- examples/testtable.rb
|
52
|
-
- examples/testtabp.rb
|
53
|
-
- examples/testtodo.rb
|
54
|
-
- examples/todocsv.csv
|
55
|
-
- examples/viewtodo.rb
|
56
|
-
- lib/rbcurse.rb
|
57
50
|
- lib/rbcurse/action.rb
|
58
51
|
- lib/rbcurse/applicationheader.rb
|
59
52
|
- lib/rbcurse/celleditor.rb
|
@@ -61,34 +54,85 @@ files:
|
|
61
54
|
- lib/rbcurse/colormap.rb
|
62
55
|
- lib/rbcurse/comboboxcellrenderer.rb
|
63
56
|
- lib/rbcurse/defaultlistselectionmodel.rb
|
57
|
+
- lib/rbcurse/io.rb
|
64
58
|
- lib/rbcurse/keylabelprinter.rb
|
65
59
|
- lib/rbcurse/listcellrenderer.rb
|
60
|
+
- lib/rbcurse/listeditable.rb
|
66
61
|
- lib/rbcurse/listkeys.rb
|
67
62
|
- lib/rbcurse/listscrollable.rb
|
68
63
|
- lib/rbcurse/listselectable.rb
|
69
64
|
- lib/rbcurse/mapper.rb
|
70
65
|
- lib/rbcurse/orderedhash.rb
|
66
|
+
- lib/rbcurse/rchangeevent.rb
|
71
67
|
- lib/rbcurse/rcombo.rb
|
72
68
|
- lib/rbcurse/rdialogs.rb
|
69
|
+
- lib/rbcurse/rform.rb
|
73
70
|
- lib/rbcurse/rinputdataevent.rb
|
74
71
|
- lib/rbcurse/rlistbox.rb
|
75
72
|
- lib/rbcurse/rmenu.rb
|
76
73
|
- lib/rbcurse/rmessagebox.rb
|
74
|
+
- lib/rbcurse/rmulticontainer.rb
|
75
|
+
- lib/rbcurse/rmultitextview.rb
|
77
76
|
- lib/rbcurse/rpopupmenu.rb
|
77
|
+
- lib/rbcurse/rscrollform.rb
|
78
|
+
- lib/rbcurse/rscrollpane.rb
|
79
|
+
- lib/rbcurse/rsplitpane.rb
|
78
80
|
- lib/rbcurse/rtabbedpane.rb
|
81
|
+
- lib/rbcurse/rtabbedwindow.rb
|
79
82
|
- lib/rbcurse/rtable.rb
|
80
83
|
- lib/rbcurse/rtextarea.rb
|
81
84
|
- lib/rbcurse/rtextview.rb
|
85
|
+
- lib/rbcurse/rviewport.rb
|
82
86
|
- lib/rbcurse/rwidget.rb
|
83
87
|
- lib/rbcurse/scrollable.rb
|
84
88
|
- lib/rbcurse/selectable.rb
|
85
89
|
- lib/rbcurse/table/tablecellrenderer.rb
|
86
90
|
- lib/rbcurse/table/tabledatecellrenderer.rb
|
91
|
+
- lib/rbcurse/undomanager.rb
|
92
|
+
- lib/rbcurse/vieditable.rb
|
93
|
+
- lib/rbcurse.rb
|
87
94
|
- lib/ver/keyboard.rb
|
88
95
|
- lib/ver/keyboard2.rb
|
89
96
|
- lib/ver/ncurses.rb
|
90
97
|
- lib/ver/window.rb
|
91
|
-
-
|
98
|
+
- examples/keytest.rb
|
99
|
+
- examples/mpad2.rb
|
100
|
+
- examples/newtesttabp.rb
|
101
|
+
- examples/qdfilechooser.rb
|
102
|
+
- examples/rfe.rb
|
103
|
+
- examples/rfe_renderer.rb
|
104
|
+
- examples/rvimsplit.rb
|
105
|
+
- examples/sqlc.rb
|
106
|
+
- examples/sqlm.rb
|
107
|
+
- examples/test1.rb
|
108
|
+
- examples/test2.rb
|
109
|
+
- examples/testchars.rb
|
110
|
+
- examples/testcombo.rb
|
111
|
+
- examples/testkeypress.rb
|
112
|
+
- examples/testmenu.rb
|
113
|
+
- examples/testmulticomp.rb
|
114
|
+
- examples/testscroller.rb
|
115
|
+
- examples/testscrolllb.rb
|
116
|
+
- examples/testscrollp.rb
|
117
|
+
- examples/testscrollta.rb
|
118
|
+
- examples/testscrolltable.rb
|
119
|
+
- examples/testsplit.rb
|
120
|
+
- examples/testsplit2.rb
|
121
|
+
- examples/testsplit3.rb
|
122
|
+
- examples/testsplit3_1.rb
|
123
|
+
- examples/testsplit3a.rb
|
124
|
+
- examples/testsplit3b.rb
|
125
|
+
- examples/testsplitta.rb
|
126
|
+
- examples/testsplittv.rb
|
127
|
+
- examples/testsplittvv.rb
|
128
|
+
- examples/testtable.rb
|
129
|
+
- examples/testtabp.rb
|
130
|
+
- examples/testtestw.rb
|
131
|
+
- examples/testtodo.rb
|
132
|
+
- examples/testtpane.rb
|
133
|
+
- examples/testtpane2.rb
|
134
|
+
- examples/testtpanetable.rb
|
135
|
+
- examples/viewtodo.rb
|
92
136
|
has_rdoc: true
|
93
137
|
homepage: http://rbcurse.rubyforge.org/
|
94
138
|
post_install_message:
|
data/README.txt
DELETED
@@ -1,312 +0,0 @@
|
|
1
|
-
= rbcurse
|
2
|
-
|
3
|
-
* http://totalrecall.wordpress.com << CORRECTED !!!
|
4
|
-
|
5
|
-
* rbcurse on rubyforge: http://rbcurse.rubyforge.org/
|
6
|
-
|
7
|
-
* See latest changes on http://github.com/rkumar/rbcurse/tree/master/CHANGELOG
|
8
|
-
|
9
|
-
* Many working demos in examples folder, such as:
|
10
|
-
|
11
|
-
* test2.rb (exit with F1, Or Cancel button/Alt-C) contains various
|
12
|
-
widgets. F2 for menubar toggling
|
13
|
-
|
14
|
-
* rfe.rb is a ruby file explorer
|
15
|
-
|
16
|
-
* sqlc.rb is a ruby sql client demo (using testd.db at
|
17
|
-
http://www.benegal.org/files/screen/testd.db)
|
18
|
-
|
19
|
-
* testtodo.rb is a test TODO application
|
20
|
-
|
21
|
-
* Screenshots on
|
22
|
-
http://www.benegal.org/files/screen/?M=D (new)
|
23
|
-
and on blog, http://totalrecall.wordpress.com
|
24
|
-
and http://github.com/rkumar/rbcurse/wikis/screenshots (old)
|
25
|
-
|
26
|
-
* Todo (for 0.1.2): http://rubyforge.org/pm/task.php?group_id=7775&group_project_id=13812&func=browse
|
27
|
-
|
28
|
-
* Next Major Release: http://rubyforge.org/pm/task.php?group_project_id=13813&group_id=7775&func=browse
|
29
|
-
|
30
|
-
== DESCRIPTION:
|
31
|
-
|
32
|
-
A small but comprehensive widget library written in ruby for creating ncurses
|
33
|
-
applications.
|
34
|
-
|
35
|
-
== FEATURES
|
36
|
-
|
37
|
-
* entry fields in ruby
|
38
|
-
* scrollable list box (new, editable with Field, checkbox and combos)
|
39
|
-
* multi-line editable area
|
40
|
-
* togglebutton, radio and check buttons (with mnemonics)
|
41
|
-
* message box
|
42
|
-
* menubar - with submenu and CheckBoxMenuItem
|
43
|
-
* popup list
|
44
|
-
* tabbedpane (multiple forms using tabbed metaphor)
|
45
|
-
* combobox
|
46
|
-
* labels with mnemonics (hotkeys)
|
47
|
-
* multi-column table - with cell selection and editing
|
48
|
-
|
49
|
-
Above may be created using DSL like syntax, or hashes.
|
50
|
-
|
51
|
-
== Sample programs:
|
52
|
-
|
53
|
-
* sqlc.rb is a ruby sql client demo
|
54
|
-
* rfe : file explorer or Finder like app
|
55
|
-
* testtodo.rb : a todo app based on a yaml file (now csv)
|
56
|
-
* test2.rb most widgets (including menus)
|
57
|
-
* test1.rb various kinds of messageboxes (input, list, custom)
|
58
|
-
* testtabp.rb tabbed pane
|
59
|
-
* testcombo.rb combos with various insert policies and vertical
|
60
|
-
alignments
|
61
|
-
|
62
|
-
== PROBLEMS, ISSUES
|
63
|
-
TextArea not bug free. Some situations wrapping errors could exist.
|
64
|
-
|
65
|
-
== Terminal related issues.
|
66
|
-
|
67
|
-
* Some terminals may not show underlines (e.g screen).
|
68
|
-
|
69
|
-
* Some terminals (xterm-color) do not process Function keys, avoid declaring F1 etc if
|
70
|
-
unsure of client terminals. I have put in fixes for xterm-color F1 and
|
71
|
-
backtab.
|
72
|
-
|
73
|
-
* To use ALT/META keys on a Mac OS X, in Terminal preferences, under
|
74
|
-
Keyboard, select
|
75
|
-
"use Option as Meta key". All hotkeys are automatically, ALT combinations.
|
76
|
-
|
77
|
-
* Some screens do not display window background color under spaces.
|
78
|
-
This is okay under "screen" and "xterm-color" but not under "xterm". You will notice
|
79
|
-
this in the message box samples.
|
80
|
-
|
81
|
-
I am developing and testing under "screen" under OS X Leopard.
|
82
|
-
|
83
|
-
== SYNOPSIS:
|
84
|
-
|
85
|
-
See lib/rbcurse/rwidgets.rb.
|
86
|
-
For test programs, see test1, test2, testcombo etc in examples folder.
|
87
|
-
|
88
|
-
This depends only on "window" provided by ncurses. Does not use forms
|
89
|
-
and fields. Minor changes and improvements may have happened to sample
|
90
|
-
code below. See test programs for latest, working code.
|
91
|
-
|
92
|
-
=== create a window and a form based on window
|
93
|
-
|
94
|
-
@layout = { :height => 0, :width => 0, :top => 0, :left => 0 }
|
95
|
-
@win = VER::Window.new(@layout)
|
96
|
-
|
97
|
-
@form = Form.new @win
|
98
|
-
|
99
|
-
|
100
|
-
=== create a bunch of fields with dependent labels
|
101
|
-
|
102
|
-
r = 1; c = 22;
|
103
|
-
%w[ name age company].each do |w|
|
104
|
-
field = Field.new @form do
|
105
|
-
name w
|
106
|
-
row r
|
107
|
-
col c
|
108
|
-
display_length 30
|
109
|
-
set_buffer "abcd #{w}"
|
110
|
-
set_label Label.new @form, {'text' => w}
|
111
|
-
end
|
112
|
-
r += 1
|
113
|
-
end
|
114
|
-
|
115
|
-
=== create a variable (like TkVariable) and tie a label to it.
|
116
|
-
|
117
|
-
$results = Variable.new
|
118
|
-
$results.value = "A variable"
|
119
|
-
var = RubyCurses::Label.new @form, {'text_variable' => $results, "row" => r, "col" => 22}
|
120
|
-
r += 1
|
121
|
-
|
122
|
-
=== create a list and a list box based on the list.
|
123
|
-
|
124
|
-
mylist = []
|
125
|
-
0.upto(100) { |v| mylist << "#{v} scrollable data" }
|
126
|
-
|
127
|
-
field = Listbox.new @form do
|
128
|
-
name "mylist"
|
129
|
-
row r
|
130
|
-
col 1
|
131
|
-
width 40
|
132
|
-
height 10
|
133
|
-
list mylist
|
134
|
-
end
|
135
|
-
field.insert 5, "hello ruby", "so long python", "farewell java", "RIP .Net"
|
136
|
-
|
137
|
-
=== create a textarea for entry
|
138
|
-
|
139
|
-
texta = TextArea.new @form do
|
140
|
-
name "mytext"
|
141
|
-
row 1
|
142
|
-
col 52
|
143
|
-
width 40
|
144
|
-
height 20
|
145
|
-
end
|
146
|
-
texta << "hello there" << "we are testing deletes in this application"
|
147
|
-
texta << "HELLO there" << "WE ARE testing deletes in this application"
|
148
|
-
|
149
|
-
=== create a check box, updates a Variable
|
150
|
-
|
151
|
-
checkbutton = CheckBox.new @form do
|
152
|
-
text_variable $results
|
153
|
-
#value = true
|
154
|
-
onvalue "selected cb"
|
155
|
-
offvalue "UNselected cb"
|
156
|
-
text "Please click me"
|
157
|
-
row 17
|
158
|
-
col 22
|
159
|
-
end
|
160
|
-
|
161
|
-
=== change field properties at any time by referring to them by name
|
162
|
-
|
163
|
-
@form.by_name["age"].display_length = 3
|
164
|
-
@form.by_name["age"].maxlen = 3
|
165
|
-
@form.by_name["age"].set_buffer "24"
|
166
|
-
@form.by_name["name"].set_buffer "Not focusable"
|
167
|
-
@form.by_name["age"].chars_allowed = /\d/
|
168
|
-
@form.by_name["company"].type(:ALPHA)
|
169
|
-
@form.by_name["name"].set_focusable(false)
|
170
|
-
|
171
|
-
@form.by_name["password"].color 'red'
|
172
|
-
@form.by_name["password"].bgcolor 'blue'
|
173
|
-
|
174
|
-
# restrict entry to some values
|
175
|
-
password.values(%w[ scotty tiger secret qwerty])
|
176
|
-
|
177
|
-
# validation using ruby's regular expressions
|
178
|
-
|
179
|
-
field.valid_regex(/^[A-Z]\d+/)
|
180
|
-
|
181
|
-
=== bind events to forms, and fields
|
182
|
-
|
183
|
-
@form.bind(:ENTER) { |f| f.label.bgcolor = $promptcolor if f.instance_of? RubyCurses::Field}
|
184
|
-
@form.bind(:LEAVE) { |f| f.label.bgcolor = $datacolor if f.instance_of? RubyCurses::Field}
|
185
|
-
|
186
|
-
=== create buttons
|
187
|
-
|
188
|
-
ok_button = Button.new @form do
|
189
|
-
text "OK"
|
190
|
-
name "OK"
|
191
|
-
row 18
|
192
|
-
col 22
|
193
|
-
end
|
194
|
-
ok_button.command { |form| $results.value = "OK PRESS:";form.printstr(@window, 23,45, "OK CALLED") }
|
195
|
-
#text "Cancel"
|
196
|
-
cancel_button = Button.new @form do
|
197
|
-
text_variable $results
|
198
|
-
row 18
|
199
|
-
col 28
|
200
|
-
end
|
201
|
-
cancel_button.command { |form| form.printstr(@window, 23,45, "Cancel CALLED"); throw(:close); }
|
202
|
-
|
203
|
-
=== create radio buttons
|
204
|
-
|
205
|
-
colorlabel = Label.new @form, {'text' => "Select a color:", "row" => 20,
|
206
|
-
"col" => 22, "color"=> "cyan"}
|
207
|
-
$radio = Variable.new
|
208
|
-
radio1 = RadioButton.new @form do
|
209
|
-
text_variable $radio
|
210
|
-
text "red"
|
211
|
-
value "red"
|
212
|
-
color "red"
|
213
|
-
row 21
|
214
|
-
col 22
|
215
|
-
end
|
216
|
-
radio2 = RadioButton.new @form do
|
217
|
-
text_variable $radio
|
218
|
-
text "green"
|
219
|
-
value "green"
|
220
|
-
color "green"
|
221
|
-
row 22
|
222
|
-
col 22
|
223
|
-
end
|
224
|
-
|
225
|
-
=== create a messagebox
|
226
|
-
|
227
|
-
@mb = RubyCurses::MessageBox.new do
|
228
|
-
title "Enter your name"
|
229
|
-
message "Enter your name"
|
230
|
-
type :input
|
231
|
-
default_value "rahul"
|
232
|
-
default_button 0
|
233
|
-
end
|
234
|
-
#title "Color selector"
|
235
|
-
#type :custom
|
236
|
-
#buttons %w[red green blue yellow]
|
237
|
-
#underlines [0,0,0,0]
|
238
|
-
|
239
|
-
$log.debug "MBOX : #{@mb.selected_index} "
|
240
|
-
$log.debug "MBOX : #{@mb.input_value} "
|
241
|
-
|
242
|
-
=== create a read-only scrollable view of data
|
243
|
-
|
244
|
-
@textview = TextView.new @form do
|
245
|
-
name "myView"
|
246
|
-
row 16
|
247
|
-
col 52
|
248
|
-
width 40
|
249
|
-
height 7
|
250
|
-
end
|
251
|
-
content = File.open("../../README.txt","r").readlines
|
252
|
-
@textview.set_content content
|
253
|
-
|
254
|
-
## set it to point to row 21
|
255
|
-
@textview.top_row 21
|
256
|
-
|
257
|
-
|
258
|
-
# lets scroll the text view as we scroll the listbox
|
259
|
-
|
260
|
-
listb.bind(:ENTER_ROW, @textview) { |arow, tview| tview.top_row arow }
|
261
|
-
|
262
|
-
# lets scroll the text view to the line you enter in the numeric
|
263
|
-
# field
|
264
|
-
@form.by_name["line"].bind(:LEAVE, @textview) { |fld, tv| tv.top_row(fld.getvalue.to_i) }
|
265
|
-
|
266
|
-
# lets scroll the text view to the first match of the regex you
|
267
|
-
# enter
|
268
|
-
@form.by_name["regex"].bind(:LEAVE, @textview) { |fld, tv| tv.top_row(tv.find_first_match(fld.getvalue)) }
|
269
|
-
|
270
|
-
# change the value of colorlabel to the selected radiobutton
|
271
|
-
# (red or green)
|
272
|
-
|
273
|
-
$radio.update_command(colorlabel) {|tv, label| label.color tv.value}
|
274
|
-
|
275
|
-
# change the attribute of colorlabel to bold or normal
|
276
|
-
|
277
|
-
$results.update_command(colorlabel,checkbutton) {|tv, label, cb|
|
278
|
-
attrs = cb.value ? 'bold' : nil; label.attrs(attrs)}
|
279
|
-
|
280
|
-
# during menu creation, create a checkboxmenuitem
|
281
|
-
|
282
|
-
item = RubyCurses::CheckBoxMenuItem.new "CheckMe"
|
283
|
-
|
284
|
-
# when selected, make colorlabel attribute reverse.
|
285
|
-
|
286
|
-
item.command(colorlabel){|it, label| att = it.getvalue ? 'reverse' :
|
287
|
-
nil; label.attrs(att); label.repaint}
|
288
|
-
|
289
|
-
== REQUIREMENTS:
|
290
|
-
|
291
|
-
* ruby 1.8.7 (not compatible with 1.9)
|
292
|
-
|
293
|
-
* ncurses-ruby
|
294
|
-
|
295
|
-
(following is provided with source)
|
296
|
-
|
297
|
-
* uses the window class created by "manveru" (michael)
|
298
|
-
It is provided with this package, and has some alterations from the
|
299
|
-
original. I have added a method getchar() which traps and returns
|
300
|
-
ALT/META, META+CTRL, META+SHIFT+CONTROL, ALT+Fn etc.
|
301
|
-
|
302
|
-
|
303
|
-
== INSTALL:
|
304
|
-
|
305
|
-
sudo gem install ncurses-ruby
|
306
|
-
sudo gem install rbcurse
|
307
|
-
|
308
|
-
== LICENSE:
|
309
|
-
|
310
|
-
Copyright (c) 2008 rkumar
|
311
|
-
|
312
|
-
Same as ruby license.
|