Method: CDK::SCROLL#createItemList

Defined in:
lib/cdk/components/scroll.rb

#createItemList(numbers, list, list_size) ⇒ Object

This function creates the scrolling list information and sets up the needed variables for the scrolling list to work correctly.



440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/cdk/components/scroll.rb', line 440

def createItemList(numbers, list, list_size)
  status = 0
  if list_size > 0
    widest_item = 0
    x = 0
    have = 0
    temp = ''
    if allocListArrays(0, list_size)
      # Create the items in the scrolling list.
      status = 1
      (0...list_size).each do |x|
        number = if numbers then x + 1 else 0 end
        if !self.allocListItem(x, temp, have, number, list[x])
          status = 0
          break
        end

        widest_item = [@item_len[x], widest_item].max
      end

      if status
        self.updateViewWidth(widest_item);

        # Keep the boolean flag 'numbers'
        @numbers = numbers
      end
    end
  else
    status = 1  # null list is ok - for a while
  end

  return status
end