rbcurse 1.5.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/Makefile +21 -0
  2. data/Manifest.txt +6 -0
  3. data/README.markdown +6 -4
  4. data/TODO +372 -0
  5. data/TODO2.txt +121 -0
  6. data/VERSION +1 -1
  7. data/examples/README.txt +67 -0
  8. data/examples/abasiclist.rb +33 -0
  9. data/examples/alpmenu.rb +42 -0
  10. data/examples/app.rb +859 -0
  11. data/examples/app.sample +17 -0
  12. data/examples/appdirtree.rb +74 -0
  13. data/examples/appemail.rb +191 -0
  14. data/examples/appemaillb.rb +308 -0
  15. data/examples/appgcompose.rb +315 -0
  16. data/examples/atree.rb +64 -0
  17. data/examples/common/file.rb +40 -0
  18. data/examples/common/rmail.rb +257 -0
  19. data/examples/data.txt +683 -0
  20. data/examples/data/README.markdown +9 -0
  21. data/examples/data/brew.txt +38 -0
  22. data/examples/data/color.2 +37 -0
  23. data/examples/data/gemlist.txt +60 -0
  24. data/examples/data/lotr.txt +12 -0
  25. data/examples/data/ports.txt +136 -0
  26. data/examples/data/tasks.txt +27 -0
  27. data/examples/data/todocsv.csv +28 -0
  28. data/examples/data/unix1.txt +21 -0
  29. data/examples/data/unix2.txt +11 -0
  30. data/examples/dbdemo.rb +495 -0
  31. data/examples/deprecated/appgmail.rb +952 -0
  32. data/examples/deprecated/splitp.rb +56 -0
  33. data/examples/deprecated/testscrolllb.rb +86 -0
  34. data/examples/deprecated/testscrollp.rb +88 -0
  35. data/examples/deprecated/testscrollta.rb +80 -0
  36. data/examples/deprecated/testscrolltable.rb +165 -0
  37. data/examples/deprecated/testsplit.rb +87 -0
  38. data/examples/deprecated/testsplit2.rb +123 -0
  39. data/examples/deprecated/testsplit3.rb +215 -0
  40. data/examples/deprecated/testsplit3_1.rb +244 -0
  41. data/examples/deprecated/testsplit3a.rb +215 -0
  42. data/examples/deprecated/testsplit3b.rb +237 -0
  43. data/examples/deprecated/testsplitta.rb +148 -0
  44. data/examples/deprecated/testsplittv.rb +142 -0
  45. data/examples/deprecated/testsplittvv.rb +144 -0
  46. data/examples/deprecated/testtpane.rb +215 -0
  47. data/examples/deprecated/testtpane2.rb +145 -0
  48. data/examples/deprecated/testtpanetable.rb +203 -0
  49. data/examples/dirtree.rb +88 -0
  50. data/examples/experimental/resultsetdemo.rb +280 -0
  51. data/examples/experimental/testmform.rb +35 -0
  52. data/examples/experimental/testscroller.rb +117 -0
  53. data/examples/experimental/teststackflow.rb +111 -0
  54. data/examples/menu1.rb +112 -0
  55. data/examples/multispl.rb +86 -0
  56. data/examples/newmessagebox.rb +131 -0
  57. data/examples/newtabbedwindow.rb +100 -0
  58. data/examples/newtesttabp.rb +121 -0
  59. data/examples/qdfilechooser.rb +68 -0
  60. data/examples/rfe.rb +1239 -0
  61. data/examples/rfe_renderer.rb +121 -0
  62. data/examples/sqlc.rb +454 -0
  63. data/examples/sqlm.rb +437 -0
  64. data/examples/sqlt.rb +408 -0
  65. data/examples/status.txt +68 -0
  66. data/examples/table1.rb +24 -0
  67. data/examples/term2.rb +84 -0
  68. data/examples/test1.rb +239 -0
  69. data/examples/test2.rb +674 -0
  70. data/examples/testapp.rb +44 -0
  71. data/examples/testapp2.rb +58 -0
  72. data/examples/testchars.rb +137 -0
  73. data/examples/testcombo.rb +91 -0
  74. data/examples/testkeypress.rb +66 -0
  75. data/examples/testlistbox.rb +113 -0
  76. data/examples/testmenu.rb +101 -0
  77. data/examples/testmulticomp.rb +70 -0
  78. data/examples/testmulticontainer.rb +94 -0
  79. data/examples/testmultispl.rb +199 -0
  80. data/examples/testree.rb +106 -0
  81. data/examples/testtable.rb +264 -0
  82. data/examples/testtabp.rb +107 -0
  83. data/examples/testtodo.rb +584 -0
  84. data/examples/testvimsplit.rb +112 -0
  85. data/examples/testwsshortcuts.rb +64 -0
  86. data/examples/testwsshortcuts2.rb +126 -0
  87. data/examples/todo.db +0 -0
  88. data/examples/todo.yml +191 -0
  89. data/examples/viewtodo.rb +574 -0
  90. data/lib/rbcurse/deprecated/README.markdown +12 -0
  91. data/lib/rbcurse/deprecated/rpad.rb +375 -0
  92. data/lib/rbcurse/deprecated/rscrollpane.rb +512 -0
  93. data/lib/rbcurse/deprecated/rsplitpane.rb +894 -0
  94. data/lib/rbcurse/deprecated/rsplitpane2.rb +1009 -0
  95. data/lib/rbcurse/deprecated/rviewport.rb +204 -0
  96. data/lib/rbcurse/deprecated/widgets/mapper.rb +130 -0
  97. data/lib/rbcurse/deprecated/widgets/rmessagebox.rb +348 -0
  98. data/lib/rbcurse/deprecated/widgets/rtabbedpane.rb +1158 -0
  99. data/lib/rbcurse/deprecated/widgets/rtabbedwindow.rb +167 -0
  100. data/lib/rbcurse/deprecated/widgets/scrollable.rb +301 -0
  101. data/lib/rbcurse/deprecated/widgets/stdscrwindow.rb +309 -0
  102. data/lib/ver/keyboard2.rb +170 -0
  103. data/test/test_rbcurse.rb +0 -0
  104. metadata +131 -9
@@ -0,0 +1,56 @@
1
+ require 'rbcurse/core/util/app'
2
+
3
+ App.new do
4
+ header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "Splitpane Demo", :text_right =>""
5
+ message_row(27)
6
+ message "<TAB> between outer panes, Alt-W between inner tabs, Alt-TAb to exit Splitpane"
7
+
8
+ stack :margin_top => 5, :margin => 15, :width => 79 do
9
+ splp = splitpane "outer", :height => 15 do |s|
10
+ fc = splitpane "top", :orientation => :VERTICAL_SPLIT, :border_color => $promptcolor, :divider_at => 0.3 do |fc1|
11
+ lb = listbox "Shapes",:list => ["Square", "Oval", "Rectangle", "Somethinglarge"], :choose => ["Oval"]
12
+ fc1.first_component lb
13
+
14
+ lb2 = listbox "MyGems", :list => ["highline", "sqlite3-ruby", "thor", "ncurses"], :choose => ["thor"]
15
+ fc1.second_component lb2
16
+
17
+ end
18
+ s.first_component fc
19
+
20
+ sc = textarea "Edit"
21
+ s.second_component sc
22
+
23
+ end # splp
24
+ blank
25
+ flow do
26
+ #toggle :onvalue => "Vertical", :offvalue => "Horizontal", :value => true do |e|
27
+ #message "pressed #{e.state}"
28
+ #case e.state
29
+ #when :DESELECTED
30
+ #$log.debug " about to call orientation with V"
31
+ #splp.orientation :VERTICAL_SPLIT
32
+ ##ret = splp.reset_to_preferred_sizes
33
+ #else
34
+ #$log.debug " about to call orientation with H"
35
+ #splp.orientation :HORIZONTAL_SPLIT
36
+ ##ret = splp.reset_to_preferred_sizes
37
+ #end
38
+ #end
39
+ fc = splp
40
+ # increase split size
41
+ button "+" do
42
+ #splp.set_divider_location(splp.divider_location+1)
43
+ fc.set_divider_location(splp.divider_location+1)
44
+ end
45
+ # decrease split size
46
+ button "-" do
47
+ fc.set_divider_location(splp.divider_location-1)
48
+ end
49
+ # equalize split size
50
+ button "=" do
51
+ splp.set_resize_weight(0.50)
52
+ end
53
+ end
54
+
55
+ end # stack
56
+ end # app
@@ -0,0 +1,86 @@
1
+ #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
+ # Creates a scrollpane with a Testwidget (which is a modified TextView class)
3
+ require 'rubygems'
4
+ #require 'ncurses' # FFI
5
+ require 'logger'
6
+ require 'rbcurse'
7
+ require 'rbcurse/extras/widgets/rlistbox'
8
+ require 'rbcurse/rscrollpane'
9
+ if $0 == __FILE__
10
+ include RubyCurses
11
+ include RubyCurses::Utils
12
+
13
+ begin
14
+ # Initialize curses
15
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
16
+ $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
17
+ $log.level = Logger::DEBUG
18
+
19
+ @window = VER::Window.root_window
20
+
21
+ catch(:close) do
22
+ colors = Ncurses.COLORS
23
+ @form = Form.new @window
24
+ r = 1; c = 10; w = 40
25
+ ht = 10
26
+ # print filler stars
27
+ filler = "*" * (w+2)
28
+ #(ht+3).times(){|i| @form.window.printstring(i,c-1, filler, $datacolor) }
29
+
30
+
31
+ @scroll = ScrollPane.new @form do
32
+ name "myScroller"
33
+ row r+ht+1
34
+ col c
35
+ width w
36
+ height ht
37
+ end
38
+ mylist = []
39
+ 0.upto(100) { |v| mylist << "#{v} scrollable data" }
40
+ $listdata = Variable.new mylist
41
+ # NOTE that embedded object is not passed form, since it doesn't update form
42
+ listb = Listbox.new nil do
43
+ name "mylist"
44
+ row 0
45
+ col 0
46
+ width w+10
47
+ height ht+10
48
+ list_variable $listdata
49
+ #selection_mode :SINGLE
50
+ show_selector true
51
+ row_selected_symbol "[X] "
52
+ row_unselected_symbol "[ ] "
53
+ title "A long list"
54
+ title_attrib 'reverse'
55
+ cell_editing_allowed true
56
+ end
57
+ ## The next 2 are not advised since they don't trigger events
58
+ #listb.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
59
+ #$listdata.value.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net"
60
+ listb.list_data_model.insert 55, "hello ruby", "so long python", "farewell java", "RIP .Net", "hi lisp", "hi clojure", "hiya erlang"
61
+ @scroll.child(listb)
62
+
63
+
64
+ @help = "q to quit. This is a test of Listbox which uses a pad/buffer.: #{$0}"
65
+ #RubyCurses::Label.new @form, {'text' => @help, "row" => 21, "col" => 2, "color" => "yellow"}
66
+
67
+ @form.repaint
68
+ @window.wrefresh
69
+ Ncurses::Panel.update_panels
70
+ while((ch = @window.getchar()) != ?q.getbyte(0) )
71
+ str = keycode_tos ch
72
+ @form.handle_key(ch)
73
+ @form.repaint
74
+ @window.wrefresh
75
+ end
76
+ end
77
+ rescue => ex
78
+ ensure
79
+ @window.destroy if !@window.nil?
80
+ VER::stop_ncurses
81
+ p ex if ex
82
+ p(ex.backtrace.join("\n")) if ex
83
+ $log.debug( ex) if ex
84
+ $log.debug(ex.backtrace.join("\n")) if ex
85
+ end
86
+ end
@@ -0,0 +1,88 @@
1
+ #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
+ # Creates a scrollpane with a TextView (which is a modified TextView class)
3
+ require 'rubygems'
4
+ #require 'ncurses' # FFI
5
+ require 'logger'
6
+ require 'rbcurse'
7
+ #require 'rbcurse/core/widgets/rtextview'
8
+ require 'rbcurse/extras/widgets/rmultitextview'
9
+ require 'rbcurse/rscrollpane'
10
+ require 'rbcurse/experimental/widgets/undomanager'
11
+ if $0 == __FILE__
12
+ include RubyCurses
13
+ include RubyCurses::Utils
14
+
15
+ begin
16
+ # Initialize curses
17
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
18
+ $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
19
+ $log.level = Logger::DEBUG
20
+
21
+
22
+ @window = VER::Window.root_window
23
+
24
+ catch(:close) do
25
+ colors = Ncurses.COLORS
26
+ @form = Form.new @window
27
+ @form.name = "Form::MAINFORM"
28
+ r = 3; c = 5; w = 80
29
+ ht = 20
30
+ # print filler stars
31
+ #filler = "*" * (w+2)
32
+ #(ht+3).times(){|i| @form.window.printstring(i,c-1, filler, $datacolor) }
33
+
34
+
35
+ @scroll = ScrollPane.new @form do
36
+ name "myScroller"
37
+ row r
38
+ col c
39
+ width w
40
+ height ht
41
+ end
42
+ @textview = MultiTextView.new do
43
+ #@textview = TextView.new do
44
+ name "myView"
45
+ row 0
46
+ col 0
47
+ width w
48
+ height ht +20
49
+ title "README.txt"
50
+ title_attrib 'bold'
51
+ print_footer true
52
+ footer_attrib 'bold'
53
+ #suppress_borders true
54
+ end
55
+ #@textview.should_create_buffer true # can be moved to scrollpane
56
+ #@textview.set_buffering(:target_window => @form.window, :bottom => @scroll.height-1, :right => @scroll.width-1 )
57
+ #content = File.open("../README.markdown","r").readlines
58
+ #@textview.set_content content #, :WRAP_WORD
59
+ @textview.add "../README.markdown", "Readme"
60
+
61
+ @textview.load_module "vieditable", "ViEditable"
62
+ @scroll.child(@textview)
63
+ undom = SimpleUndo.new @textview
64
+ #@textview.show_caret=true
65
+
66
+ @help = "F1 to quit. #{$0} TextView inside scrollpane. M-n M-p M-h M-l M-< M->, e to open file, : for menu"
67
+ RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r+1, "col" => 2, "color" => "yellow"}
68
+
69
+ @form.repaint
70
+ @window.wrefresh
71
+ Ncurses::Panel.update_panels
72
+ while((ch = @window.getchar()) != KEY_F1 ) # ?q.getbyte(0) )
73
+ str = keycode_tos ch
74
+ @form.handle_key(ch)
75
+ @form.repaint
76
+ @window.wrefresh
77
+ end
78
+ end
79
+ rescue => ex
80
+ ensure
81
+ @window.destroy if !@window.nil?
82
+ VER::stop_ncurses
83
+ p ex if ex
84
+ p(ex.backtrace.join("\n")) if ex
85
+ $log.debug( ex) if ex
86
+ $log.debug(ex.backtrace.join("\n")) if ex
87
+ end
88
+ end
@@ -0,0 +1,80 @@
1
+ #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
+ # Creates a scrollpane with a Testwidget (which is a modified TextView class)
3
+ require 'rubygems'
4
+ #require 'ncurses' # FFI
5
+ require 'logger'
6
+ require 'rbcurse'
7
+ require 'rbcurse/core/widgets/rtextarea'
8
+ require 'rbcurse/rscrollpane'
9
+ if $0 == __FILE__
10
+ include RubyCurses
11
+ include RubyCurses::Utils
12
+
13
+ begin
14
+ # Initialize curses
15
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
16
+ $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
17
+ $log.level = Logger::DEBUG
18
+
19
+ @window = VER::Window.root_window
20
+
21
+ catch(:close) do
22
+ colors = Ncurses.COLORS
23
+ @form = Form.new @window
24
+ @form.name = "Form::MAINFORM"
25
+ $log.debug " MAIN FORM #{@form} w #{@window} "
26
+ r = 3; c = 10; w = 40
27
+ ht = 10
28
+
29
+
30
+ @scroll = ScrollPane.new @form do
31
+ name "myScroller"
32
+ row r+1
33
+ col c
34
+ width w
35
+ height ht
36
+ end
37
+ # XXX we are passing nil as form, so its bound to bomb FIXME TODO
38
+ @textview = TextArea.new @nil do
39
+ name "myText"
40
+ row 0
41
+ col 0
42
+ width w+10
43
+ height ht+10
44
+ title "EditMe.txt"
45
+ title_attrib 'bold'
46
+ print_footer true
47
+ footer_attrib 'bold'
48
+ end
49
+ @scroll.child(@textview)
50
+ @textview << "I expect to pass through this world but once." << "Any good therefore that I can do, or any kindness or abilities that I can show to any fellow creature, let me do it now."
51
+ @textview << "Let me not defer it or neglect it, for I shall not pass this way again."
52
+ @textview << " "
53
+ @textview << "F1 to exit. M-n, M-p, M-h, M-l for scrolling."
54
+ @textview << "Some more text going below scrollpane.. "
55
+ @textview << "Try C-[ C-] for going to start and end "
56
+
57
+
58
+ @help = "F1 to quit. #{$0}. This is a test of TextArea inside a Scrollpane (it uses a pad/buffer)."
59
+ RubyCurses::Label.new @form, {'text' => @help, "row" => 23, "col" => 2, "color" => "yellow"}
60
+
61
+ @form.repaint
62
+ @window.wrefresh
63
+ Ncurses::Panel.update_panels
64
+ while((ch = @window.getchar()) != KEY_F1)
65
+ str = keycode_tos ch
66
+ @form.handle_key(ch)
67
+ @form.repaint
68
+ @window.wrefresh
69
+ end
70
+ end
71
+ rescue => ex
72
+ ensure
73
+ @window.destroy if !@window.nil?
74
+ VER::stop_ncurses
75
+ p ex if ex
76
+ p(ex.backtrace.join("\n")) if ex
77
+ $log.debug( ex) if ex
78
+ $log.debug(ex.backtrace.join("\n")) if ex
79
+ end
80
+ end
@@ -0,0 +1,165 @@
1
+ #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
+ #*******************************************************#
3
+ # testsrolltable.rb #
4
+ # written by Rahul Kumar #
5
+ # January 18, 2010 #
6
+ # #
7
+ # Test table inside a scrollpane. #
8
+ # The table here has minimal functionality. Pls refer #
9
+ # testtable.rb for more complete functionality. #
10
+ #
11
+ # /----+----+----+-----\
12
+ # |____|____|____|_____|
13
+ # | | | | V|
14
+ # | | | | V|
15
+ # + | | | V|
16
+ # | | | | V|
17
+ # | | | | V|
18
+ # |>>>>>>>>>>> | |
19
+ # \----+----+----+-----/
20
+ # http://totalrecall.files.wordpress.com/2010/01/rbcurse-tablescrollpane.png
21
+ #
22
+ #
23
+ # Released under ruby license. See #
24
+ # http://www.ruby-lang.org/en/LICENSE.txt #
25
+ # Copyright 2010, Rahul Kumar #
26
+ #*******************************************************#
27
+ # Creates a scrollpane with a Table
28
+ require 'rubygems'
29
+ #require 'ncurses' # FFI
30
+ require 'logger'
31
+ require 'rbcurse'
32
+ require 'rbcurse/extras/widgets/rtable'
33
+ require 'rbcurse/rscrollpane'
34
+ if $0 == __FILE__
35
+ include RubyCurses
36
+ include RubyCurses::Utils
37
+
38
+ begin
39
+ # Initialize curses
40
+ VER::start_ncurses # this is initializing colors via ColorMap.setup
41
+ $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
42
+ $log.level = Logger::DEBUG
43
+
44
+ @window = VER::Window.root_window
45
+
46
+ catch(:close) do
47
+ colors = Ncurses.COLORS
48
+ @form = Form.new @window
49
+ r = 3; c = 7; w = 80
50
+ ht = 20
51
+
52
+ scroll = ScrollPane.new @form do
53
+ name "myScroller"
54
+ row r
55
+ col c
56
+ width w
57
+ height ht
58
+ end
59
+ data = [["Pathetique",3,"Tchaikovsky",3.21, true, "WIP"],
60
+ ["Ali Maula Ali Maula",3,"NFAK",3.47, true, "WIP"],
61
+ ["Tera Hijr Mera Nasib",92,"Razia Sultan",412, true, "Fin"],
62
+ ["Piano Concerto 4&5",4,"Beethoven",110.0, false, "Cancel"],
63
+ ["Toccata and Fugue",4,"J S Bach",102.72, false, "Postp"],
64
+ ["Symphony No. 3",4,"Henryk Gorecki",102.72, true, "Postp"],
65
+ ["The Great Gig in the Sky",8,"Pink Floyd",12.72, false, "Todo"],
66
+ ["Steppes of Central Asia",9,"Borodin",12.2, false, "WIP"],
67
+ ["Wish You Were Here",8,"Pink Floyd",2.7, false, "Todo"],
68
+ ["Habanera",nil,"Maria Callas",112.7, true, "Cancel"],
69
+ ["Mack the Knife",9,"Loius Armstrong",12.2, false, "Todo"],
70
+ ["Prince Igor",9,"Borodin",16.3, false, "WIP"],
71
+ ["Shahbaaz Qalandar",9,"Nusrat Fateh Ali Khan",12.2, false, "Todo"],
72
+ ["Raag Darbari",9,"Ustad Fateh Ali Khan",12.2, false, "Todo"],
73
+ ["Yaad-e-Mustafa Aisi",9,"Santoo Khan",12.2, true, "Todo"],
74
+ ["Chaconne",4,"Johann S Bach",12.42, true, "Postp"],
75
+ ["Raag Jaunpuri",9,"Ustad Fateh Ali Khan",12.2, false, "Todo"],
76
+ ["Dalaleragita",9,"Vaishnava",12.2, false, "Todo"],
77
+ ["Prasada sevaya",9,"Vaishnava",12.2, false, "Todo"],
78
+ ["Sri Rupamanjiri",9,"Vaishnava",12.2, false, "Todo"],
79
+ ["M Vlast ",9,"Smetana",12.2, false, "Todo"],
80
+ ["Jai Radha Madhava",163,"Jagjit Singh",5.4, false, "WIP"]]
81
+
82
+ colnames = %w[ Song Cat Artist Ratio Flag Status]
83
+ statuses = ["Todo", "WIP", "Fin", "Cancel", "Postp"]
84
+
85
+ atable = Table.new nil do
86
+ name "mytext"
87
+ row 0
88
+ col 0
89
+ width 78
90
+ height 15
91
+ #title "A Table"
92
+ #title_attrib (Ncurses::A_REVERSE | Ncurses::A_BOLD)
93
+ cell_editing_allowed true
94
+ editing_policy :EDITING_AUTO
95
+ set_data data, colnames
96
+ end
97
+ sel_col = Variable.new 0
98
+ sel_col.value = 0
99
+ tcm = atable.get_table_column_model
100
+ selcolname = atable.get_column_name sel_col.value
101
+ #
102
+ ## key bindings fo atable
103
+ # column widths
104
+ tcm.column(0).width 24
105
+ tcm.column(1).width 5
106
+ tcm.column(2).width 18
107
+ #tcm.column(2).editable false
108
+ tcm.column(3).width 7
109
+ tcm.column(4).width 5
110
+ tcm.column(5).width 8
111
+ atable.configure() do
112
+ bind_key(330) { atable.remove_column(tcm.column(atable.focussed_col)) rescue "" }
113
+ bind_key(?+) {
114
+ acolumn = atable.get_column selcolname
115
+ w = acolumn.width + 1
116
+ acolumn.width w
117
+ #atable.table_structure_changed
118
+ }
119
+ bind_key(?-) {
120
+ acolumn = atable.get_column selcolname
121
+ w = acolumn.width - 1
122
+ if w > 3
123
+ acolumn.width w
124
+ #atable.table_structure_changed
125
+ end
126
+ }
127
+ bind_key(?>) {
128
+ colcount = tcm.column_count-1
129
+ #atable.move_column sel_col.value, sel_col.value+1 unless sel_col.value == colcount
130
+ col = atable.focussed_col
131
+ atable.move_column col, col+1 unless col == colcount
132
+ }
133
+ bind_key(?<) {
134
+ col = atable.focussed_col
135
+ atable.move_column col, col-1 unless col == 0
136
+ #atable.move_column sel_col.value, sel_col.value-1 unless sel_col.value == 0
137
+ }
138
+ #bind_key(KEY_RIGHT) { sel_col.value = sel_col.value+1; current_column sel_col.value}
139
+ #bind_key(KEY_LEFT) { sel_col.value = sel_col.value-1;current_column sel_col.value}
140
+ end
141
+ scroll.child(atable)
142
+
143
+ @help = "F1 to quit. This is a test of Table inside a scrollpane. #{$0} M-n M-p M-< M-> M-h M-l"
144
+ RubyCurses::Label.new @form, {'text' => @help, "row" => ht+r+1, "col" => 2, "color" => "yellow"}
145
+
146
+ @form.repaint
147
+ @window.wrefresh
148
+ Ncurses::Panel.update_panels
149
+ while((ch = @window.getchar()) != KEY_F1 ) # ?q.getbyte(0) )
150
+ str = keycode_tos ch
151
+ @form.handle_key(ch)
152
+ @form.repaint
153
+ @window.wrefresh
154
+ end
155
+ end
156
+ rescue => ex
157
+ ensure
158
+ @window.destroy if !@window.nil?
159
+ VER::stop_ncurses
160
+ p ex if ex
161
+ p(ex.backtrace.join("\n")) if ex
162
+ $log.debug( ex) if ex
163
+ $log.debug(ex.backtrace.join("\n")) if ex
164
+ end
165
+ end