[wxMac 2.8.7] Problem with native list control

Fulvio Senore mailing at fsoft.it
Wed Jan 2 00:26:24 PST 2008


I have a program that is working well under Linux and Windows, and now I 
am trying to port it to OSX.

Everything is working fine, but I have a problem with the wxListCtrl 
control. I am using it in report mode: I add rows to it but I always see 
only one row in the control. I use the following code (I removed some 
code to avoid line wrapping):

wxListCtrl lctl;
...
...
wxListItem item;
item.SetMask( 
wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE|wxLIST_MASK_DATA );
int i = lctl->InsertItem( item );
lctl->SetItem( i, 0, files.FileName, imageIndex );
lctl->SetItem( i, 1, files.IsFolder() ? "" : 
CUtils::HumanReadableFileSize(files.FileSize) );
lctl->SetItem( i, 2, files.FileExt );
lctl->SetItem( i, 3, files.DateTime.FormatDate() + " " + 
files.DateTime.FormatTime() );
lctl->SetItem( i, 4, 
FormatObjectDescriptionForListView(files.FileDescription) );
MyListItemData *itemData = new MyListItemData( ... );
lctl->SetItemData( i, (long) itemData );


I have seen in the debugger that lctl->InsertItem() always returns 0: it 
should return increasing numbers.
I tried "item.SetId()" to set increasing numbers to the item before 
adding it: I can see all the rows, but the control works in a weird way 
after sorting it clicking the column headers.

I forced the use of the generic list control:
wxSystemOptions::SetOption( wxT("mac.listctrl.always_use_generic"), 1 );
and now everything is working well, so this is not a great problem for 
me, but I think that you would like to know about it.

Fulvio Senore




More information about the wx-users mailing list