From: Lloyd on
I am using a vector to store the data, which has to be returned when the
wxListCtrl::OnGetItemText() call is made. I would like to add a feature
to my application like, when the user clicks on the list's column
header, to sort the list data based on the header (So I will be sorting
my vector).

When the mouse click event occurs on a specific raw, how can I retrieve
the data?

When I checked wxListEvent class I saw three functions appropriate

GetIndex() - It is irrelevant for me, though the position of data in
vector continuously changes

GetData()
GetItem() - I these two cases I have not set any data (I could not set
data,though it is virtual), so retrieval is invalid!

Thanks,
Lloyd



On Tue, 2006-12-12 at 10:22 +0100, Vadim Zeitlin wrote:
> On Tue, 12 Dec 2006 10:10:58 +0530 Lloyd <lloyd(a)cdactvm.in> wrote:
>
> L> I am using the wxListCtrl in wxLC_REPORT|wxLC_VIRTUAL mode to insert
> L> the data. Is there any way for me to assign some kind of hidden data
> L> with each raw?
>
> It doesn't make much sense to do this. If you use wxLC_VIRTUAL mode you
> already have the data shown in the control somewhere else, why don't you
> just add whatever "hidden" data you have to the same place?
>
> Regards,
> VZ
>


______________________________________
Scanned and protected by Email scanner

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: Lloyd on
Thanks Vadim, I was wrong! As you said, it will work if I sort the
vector also.

I know wxLC_VIRTUAL is meant for when we have 1000s of rows! If I try to
sort my huge vector each time, it will take considerable time!

Can I solve this problem without sorting the vector?

On Tue, 2006-12-12 at 10:46 +0100, Vadim Zeitlin wrote:
> On Tue, 12 Dec 2006 15:17:47 +0530 Lloyd <lloyd(a)cdactvm.in> wrote:
>
> L> GetIndex() - It is irrelevant for me, though the position of data in
> L> vector continuously changes
>
> This is the only thing you have and it should be enough.
>
> Regards,
> VZ
>


______________________________________
Scanned and protected by Email scanner

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org

From: Lloyd on
Thanks vadim, It will take some time (for me) to understand what you
suggested :)

Thanks again

Lloyd.


On Tue, 2006-12-12 at 11:09 +0100, Vadim Zeitlin wrote:
> On Tue, 12 Dec 2006 15:34:17 +0530 Lloyd <lloyd(a)cdactvm.in> wrote:
>
> L> I know wxLC_VIRTUAL is meant for when we have 1000s of rows! If I try to
> L> sort my huge vector each time, it will take considerable time!
> L>
> L> Can I solve this problem without sorting the vector?
>
> Only by maintaining a separate mapping between positions on the screen and
> indices in the vector. This wouldn't be much faster if your vector contains
> "small" objects (or pointers to large ones) though. It still can be a good
> idea if you use the indices into this vector from other parts of your
> program. In general I'd advise abstracting access to the data via methods
> such as GetItemAtPosition() which would make it clear whether you access
> the item by internal index or its position on screen and would allow you to
> change the implementation later.
>
> Regards,
> VZ
>


______________________________________
Scanned and protected by Email scanner

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org
For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org