# What's a ListCtrlCompare?

**URL:** <https://www.ruby-forum.com/t/whats-a-listctrlcompare/117557>\
**Category:** wxRuby\
**Created:** [October 18, 2007, 1:11am UTC](https://www.ruby-forum.com/t/whats-a-listctrlcompare/117557 "2007-10-18T01:11:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 18, 2007, 1:11am UTC](https://www.ruby-forum.com/t/whats-a-listctrlcompare/117557/1 "2007-10-18T01:11:19Z")

</div>

Hello all,

The doc for Wx::ListCtrl#sort\_items says the method takes  
a ListCtrlCompare. I’ve searched high and low, and I can’t  
find any description of such an object.

Is there sample code somewhere in which an LC\_REPORT style  
ListCtrl offers sorting by column? That’s really all I’m  
trying to do, and if I could see it done I’m sure it would  
all make sense to me.

Thanks much!

Peralta

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 18, 2007, 1:24am UTC](https://www.ruby-forum.com/t/whats-a-listctrlcompare/117557/2 "2007-10-18T01:24:46Z")

</div>

Hi

removed\_email\_address@domain.invalid wrote:

> The doc for Wx::ListCtrl#sort\_items says the method takes  
> a ListCtrlCompare. I’ve searched high and low, and I can’t  
> find any description of such an object.

I think we’ve missed the little bit of work this method needs. I guess  
in Ruby it should accept a block which accepts two objects and returns  
-1, 0 or 1 to represent the sort order of those items. This is similar  
to how TreeCtrl#sort works.

But it won’t work for now - will see if we can fix this for the next  
release

thanks  
alex
