# Code for Listbox object bulk adding

**URL:** <https://www.ruby-forum.com/t/code-for-listbox-object-bulk-adding/120340>\
**Category:** wxRuby\
**Created:** [November 15, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/code-for-listbox-object-bulk-adding/120340 "2007-11-15T22:30:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jari\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@Jari\_W](https://www.ruby-forum.com/u/Jari_W)\
**Post date:** [November 15, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/code-for-listbox-object-bulk-adding/120340/1 "2007-11-15T22:30:23Z")

</div>

Hello!

Attached is a method to bulk add arrays to a list box, when the array  
isn’t a string array. Feel free to add it to wxSugar.

Example:  
arr = [[Wx::RED, “Red”],[Wx::GREEN, “Green”],[Wx::BLUE, “Blue”]]

listbox.insert\_obj\_items(arr, “[1]”)  
…would add 3 list box items with “Red”-“Green”-“Blue”

listbox.insert\_obj\_items(arr, “[1].length”)  
…would add 3 list box items with “3”-“5”-“4”

listbox.insert\_obj\_items(arr, “.length”)  
…would add 3 list box items with “2”-“2”-“2”

Best regards,

Jari W.
