hi all,
is there a way to hide an item, to re-show it removing a specific filter ?
regards,
angelo
wxListCtrl, how to simply hide items for filtering
-
- Ultimate wxWidgets Guru
- Posts: 672
- Joined: Tue Aug 31, 2010 6:22 am
- Location: Belgium
I don't think there is a dedicated way to hide a given element of a wxListCtrl.
What you can do is handle yourself the elemetns that will be displayed. In this case, you can use the wxListCtrl in wxLC_VIRTUAL mode. So, to hide an element, you simply reconfigure the number of elements that are contained (wxListCtrl::SetItemCount) and you refresh all items located after the first element removed (wxListCtrl::RefreshItems).
What you can do is handle yourself the elemetns that will be displayed. In this case, you can use the wxListCtrl in wxLC_VIRTUAL mode. So, to hide an element, you simply reconfigure the number of elements that are contained (wxListCtrl::SetItemCount) and you refresh all items located after the first element removed (wxListCtrl::RefreshItems).
Re: wxListCtrl, how to simply hide items for filtering
hi all,
many thanks, maybe is better i explain better what i am trying to do, so maybe you can give me the best way to reach this:
I receive some messages (UDP) from the network, and append them to a 4 colum wxListCtrl (time,IP,level,message).
I need to add a feature to filter for IP, that when is applied, shows only the filtered IP's, including the messages already added before.
Also, i need of course to remove the filter and show all back.
Is possible wxListCtrl is not appropriate ?
Any suggestion for a good method is really appreciated.
many thanks
angelo
many thanks, maybe is better i explain better what i am trying to do, so maybe you can give me the best way to reach this:
I receive some messages (UDP) from the network, and append them to a 4 colum wxListCtrl (time,IP,level,message).
I need to add a feature to filter for IP, that when is applied, shows only the filtered IP's, including the messages already added before.
Also, i need of course to remove the filter and show all back.
Is possible wxListCtrl is not appropriate ?
Any suggestion for a good method is really appreciated.
many thanks
angelo
spectrum
-
- Ultimate wxWidgets Guru
- Posts: 672
- Joined: Tue Aug 31, 2010 6:22 am
- Location: Belgium
Re: wxListCtrl, how to simply hide items for filtering
For me wxListCtrl is appropriate for this purpose, but you will have to implement filtering yourself. You can perform that with the method I described in previous post.
Re: wxListCtrl, how to simply hide items for filtering
Hi Angelo,
One possibility if using wx2.9 is to use a wxGrid as this has ShowRow/HideRow methods.
Note that I've not tried this before myself.
Cheers
Nigel
One possibility if using wx2.9 is to use a wxGrid as this has ShowRow/HideRow methods.
Note that I've not tried this before myself.
Cheers
Nigel
-
- Earned a small fee
- Posts: 13
- Joined: Wed Jun 22, 2011 6:01 pm
Re: wxListCtrl, how to simply hide items for filtering
I did this myself.
I added a wxSearchCtrl entry area. Then when the event for the wxSearchCtrl occurrs, I DeleteAllItems() in the wxListCtrl. And go back thru and only add items that return true for listString.Matches(filterString).
My default filterString is "*"
If you need you can get more complicated than the simple wxString::Matches() method.
-- Scott
I added a wxSearchCtrl entry area. Then when the event for the wxSearchCtrl occurrs, I DeleteAllItems() in the wxListCtrl. And go back thru and only add items that return true for listString.Matches(filterString).
My default filterString is "*"
If you need you can get more complicated than the simple wxString::Matches() method.
-- Scott