Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2889b47ab5
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 276 lines (256 sloc) 10.596 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275

function! forms#example#slider#Make()
  function! S2HSliderAction(...) dict
    let value = "".a:1
    call self.editor.setText(value)
  endfunction

  function! S2EditorAction(...) dict
    let value = a:1 + 0
    try
      call self.hslider.setRangeValue(value)
    catch /.*/
" call forms#log("S2EditorAction.execute: exception=" . v:exception)
    endtry
  endfunction

  let hsa1 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea1 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 2,
            \ 'on_move_action' : hsa1,
            \ 'range' : [0,10]
            \ }
  let hs1 = forms#newHSlider(attrs)
  let ea1.hslider = hs1
  let b1 = forms#newBox({ 'body': hs1} )
  let sp1 = forms#newHSpace({ 'size': 1} )
  let e1 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea1,
                                  \ 'init_text': '0'})
  let hsa1.editor = e1
  let hpoly1 = forms#newHPoly({ 'children': [b1, sp1, e1], 'alignment': 'C' })

  let hsa2 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea2 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 2,
            \ 'resolution' : 2,
            \ 'on_move_action' : hsa2,
            \ 'range' : [0,10]
            \ }
  let hs2 = forms#newHSlider(attrs)
  let ea2.hslider = hs2
  let b2 = forms#newBox({ 'body': hs2} )
  let sp2 = forms#newHSpace({ 'size': 1} )
  let e2 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea2,
                                  \ 'init_text': '0'})
  let hsa2.editor = e2
  let hpoly2 = forms#newHPoly({ 'children': [b2, sp2, e2], 'alignment': 'C' })

  let hsa3 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea3 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 3,
            \ 'resolution' : 2,
            \ 'on_move_action' : hsa3,
            \ 'range' : [0,10]
            \ }
  let hs3 = forms#newHSlider(attrs)
  let ea3.hslider = hs3
  let b3 = forms#newBox({ 'body': hs3} )
  let sp3 = forms#newHSpace({ 'size': 1} )
  let e3 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea3,
                                  \ 'init_text': '0'})
  let hsa3.editor = e3
  let hpoly3 = forms#newHPoly({ 'children': [b3, sp3, e3], 'alignment': 'C' })

  let hsa4 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea4 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 2,
            \ 'on_move_action' : hsa4,
            \ 'range' : [0,10]
            \ }
  let hs4 = forms#newHSlider(attrs)
  let ea4.hslider = hs4
  let b4 = forms#newBox({ 'body': hs4} )
  let sp4 = forms#newHSpace({ 'size': 1} )
  let e4 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea4,
                                  \ 'init_text': '0'})
  let hsa4.editor = e4
  let hpoly4 = forms#newHPoly({ 'children': [b4, sp4, e4], 'alignment': 'C' })

  let hsa5 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea5 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 3,
            \ 'on_move_action' : hsa5,
            \ 'range' : [0,20]
            \ }
  let hs5 = forms#newHSlider(attrs)
  let ea5.hslider = hs5
  let b5 = forms#newBox({ 'body': hs5} )
  let sp5 = forms#newHSpace({ 'size': 1} )
  let e5 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea5,
                                  \ 'init_text': '0'})
  let hsa5.editor = e5
  let hpoly5 = forms#newHPoly({ 'children': [b5, sp5, e5], 'alignment': 'C' })

  let hsa6 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let ea6 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 4,
            \ 'on_move_action' : hsa6,
            \ 'range' : [0,32]
            \ }
  let hs6 = forms#newHSlider(attrs)
  let ea6.hslider = hs6
  let b6 = forms#newBox({ 'body': hs6} )
  let sp6 = forms#newHSpace({ 'size': 1} )
  let e6 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : ea6,
                                  \ 'init_text': '0'})
  let hsa6.editor = e6
  let hpoly6 = forms#newHPoly({ 'children': [b6, sp6, e6], 'alignment': 'C' })

  let vpolyh = forms#newVPoly({ 'children': [
                                  \ hpoly1,
                                  \ hpoly2,
                                  \ hpoly3,
                                  \ hpoly4,
                                  \ hpoly5,
                                  \ hpoly6
                                  \ ] })

"....................

  let vsa1 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea1 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 2,
            \ 'on_move_action' : vsa1,
            \ 'range' : [0,10]
            \ }
  let vs1 = forms#newVSlider(attrs)
  let vea1.hslider = vs1
  let b1 = forms#newBox({ 'body': vs1} )
  let sp1 = forms#newVSpace({ 'size': 1} )
  let e1 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea1,
                                  \ 'init_text': '0'})
  let vsa1.editor = e1
  let vpoly1 = forms#newVPoly({ 'children': [b1, sp1, e1], 'alignment': 'C' })

  let vsa2 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea2 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 2,
            \ 'resolution' : 2,
            \ 'on_move_action' : vsa2,
            \ 'range' : [0,10]
            \ }
  let vs2 = forms#newVSlider(attrs)
  let vea2.hslider = vs2
  let b2 = forms#newBox({ 'body': vs2})
  let sp2 = forms#newVSpace({ 'size': 1})
  let e2 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea2,
                                  \ 'init_text': '0'})
  let vsa2.editor = e2
  let vpoly2 = forms#newVPoly({ 'children': [b2, sp2, e2], 'alignment': 'C' })

  let vsa3 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea3 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 3,
            \ 'resolution' : 2,
            \ 'on_move_action' : vsa3,
            \ 'range' : [0,10]
            \ }
  let vs3 = forms#newVSlider(attrs)
  let vea3.hslider = vs3
  let b3 = forms#newBox({ 'body': vs3})
  let sp3 = forms#newVSpace({ 'size': 1})
  let e3 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea3,
                                  \ 'init_text': '0'})
  let vsa3.editor = e3
  let vpoly3 = forms#newVPoly({ 'children': [b3, sp3, e3], 'alignment': 'C' })

  let vsa4 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea4 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 2,
            \ 'on_move_action' : vsa4,
            \ 'range' : [0,10]
            \ }
  let vs4 = forms#newVSlider(attrs)
  let vea4.hslider = vs4
  let b4 = forms#newBox({ 'body': vs4})
  let sp4 = forms#newVSpace({ 'size': 1})
  let e4 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea4,
                                  \ 'init_text': '0'})
  let vsa4.editor = e4
  let vpoly4 = forms#newVPoly({ 'children': [b4, sp4, e4], 'alignment': 'C' })

  let vsa5 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea5 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 3,
            \ 'on_move_action' : vsa5,
            \ 'range' : [0,20]
            \ }
  let vs5 = forms#newVSlider(attrs)
  let vea5.hslider = vs5
  let b5 = forms#newBox({ 'body': vs5})
  let sp5 = forms#newVSpace({ 'size': 1})
  let e5 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea5,
                                  \ 'init_text': '0'})
  let vsa5.editor = e5
  let vpoly5 = forms#newVPoly({ 'children': [b5, sp5, e5], 'alignment': 'C' })

  let vsa6 = forms#newAction({ 'execute': function("S2HSliderAction")})
  let vea6 = forms#newAction({ 'execute': function("S2EditorAction")})
  let attrs = {
            \ 'size' : 5,
            \ 'resolution' : 4,
            \ 'on_move_action' : vsa6,
            \ 'range' : [0,32]
            \ }
  let vs6 = forms#newVSlider(attrs)
  let vea6.hslider = vs6
  let b6 = forms#newBox({ 'body': vs6})
  let sp6 = forms#newVSpace({ 'size': 1})
  let e6 = forms#newFixedLengthField({
                                  \ 'size': 2,
                                  \ 'on_selection_action' : vea6,
                                  \ 'init_text': '0'})
  let vsa6.editor = e6
  let vpoly6 = forms#newVPoly({ 'children': [b6, sp6, e6], 'alignment': 'C' })

"....................
  let hpoly = forms#newHPoly({ 'children': [
                                      \ vpolyh,
                                      \ vpoly1,
                                      \ vpoly2,
                                      \ vpoly3,
                                      \ vpoly4,
                                      \ vpoly5,
                                      \ vpoly6],
                                      \ 'alignment': 'C' })

  let b = forms#newBorder({ 'body': hpoly })
  let bg = forms#newBackground({ 'body': b} )
  let form = forms#newForm({'body': bg })
  call form.run()
endfunction

function! forms#example#slider#MakeTest()
  call forms#AppendInput({'type': 'Sleep', 'time': 5})
  call forms#AppendInput({'type': 'Exit'})
  call forms#example#slider#Make()
endfunction
Something went wrong with that request. Please try again.