# ListCtrl loading data

**URL:** <https://www.ruby-forum.com/t/listctrl-loading-data/151210>\
**Category:** wxRuby\
**Created:** [October 18, 2008, 6:33am UTC](https://www.ruby-forum.com/t/listctrl-loading-data/151210 "2008-10-18T06:33:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [October 18, 2008, 6:33am UTC](https://www.ruby-forum.com/t/listctrl-loading-data/151210/1 "2008-10-18T06:33:39Z")

</div>

Hi all,

I’m using a ListCtrl on LC\_REPORT mode.

using set\_item(index, col, ‘value’) the list does’t get populated.

Is it a bug? which is the method to call?

i’m using ruby 1.8.6 wxruby 1.9.8 mswin32 on winXP

attached is an example.

thank you.

bio.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [October 18, 2008, 8:04am UTC](https://www.ruby-forum.com/t/listctrl-loading-data/151210/2 "2008-10-18T08:04:16Z")

</div>

The problem is, set\_item() need to have a valid item in which to set  
information on. So change the following code to represent this:

```
    insert_item(0, 'Item 0 col 0')
    set_item(0, 1, 'Item 0 col 1')
    insert_item(1, 'Item 1 col 0')
    set_item(1, 1, 'Item 1 col 1')

```

You will get better results this way, then the other way.

On Fri, Oct 17, 2008 at 11:17 AM, Fabio P.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [October 20, 2008, 3:26pm UTC](https://www.ruby-forum.com/t/listctrl-loading-data/151210/3 "2008-10-20T15:26:36Z")

</div>

Thank you Mario, now is ok 🙂

bio.

---

<div class="post-metadata">

**Author:** ![biospank](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f475e1/32.png) [@biospank](https://www.ruby-forum.com/u/biospank)\
**Post date:** [October 20, 2008, 4:34pm UTC](https://www.ruby-forum.com/t/listctrl-loading-data/151210/4 "2008-10-20T16:34:54Z")

</div>

Hi

Firstly, sorry haven’t been following the list for the last week or so.  
Have been away with work and pretty busy and haven’t had time to follow  
up everything.

Fabio P. wrote:

> ```
> insert_item(0, 'Item 0 col 0')
> set_item(0, 1, 'Item 0 col 1')
> insert_item(1, 'Item 1 col 0')
> set_item(1, 1, 'Item 1 col 1')
> 
> ```

Seeing this laid out plainly makes me think we must be able to come up  
with a syntax improvement. I was thinking of something that accepts an  
array for each row and just does the right thing…

append [“item 0 col 0”, “item 0 col 1”],  
[“item 1 col 0”, “item 1 col 1”]  
…

alex
