Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
katuday
Earned some good credits
Earned some good credits
Posts: 134
Joined: Fri Aug 17, 2012 2:22 am

Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by katuday »

I want to diplay the rownber like the way wxGird does it

Code: Select all

GetRowLabelValue (int row) const.
Is there an API function or this will require custom coding?
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by doublemax »

There is no dedicated rowlabel area in wxListCtrl. The best you could do is to display the row number in the first column.
Use the source, Luke!
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

katuday wrote: Mon Oct 14, 2019 9:18 pm I want to diplay the rownber like the way wxGird does it

Code: Select all

GetRowLabelValue (int row) const.
Is there an API function or this will require custom coding?
I'm finding something like this recently, none.
  • wxListCtrl
    support virtual mode
    no native row header
  • wxGrid
    support native row header
    no virtual mode
BTW, Ultimate Grid (https://www.codeproject.com/Articles/20 ... -Home-Page) is flexible,
and easy to use, but it's for MFC, and much slower than wxGrid. As it should be mature, I've found a bug easily when cut a joined cell.
If there is an equivalant in wxWidgets, with higher quality, higher performance and more concise interface, it'll be perfect. :lol:
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

doublemax wrote: Mon Oct 14, 2019 9:42 pm There is no dedicated rowlabel area in wxListCtrl. The best you could do is to display the row number in the first column.
I have the demand too, with wxListCtrl, to make col and row headers same style,
I have to hide column headers, override OnGetItemColumnAttr .
When supporting sorting (common demand in virtual mode), much more work has to be done.

A combinition of wxListCtrl and wxGrid is perfect.
Last edited by Ronald on Tue Oct 15, 2019 4:37 pm, edited 2 times in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by ONEEYEMAN »

Hi,
Ronald wrote: Tue Oct 15, 2019 3:11 am
katuday wrote: Mon Oct 14, 2019 9:18 pm I want to diplay the rownber like the way wxGird does it

Code: Select all

GetRowLabelValue (int row) const.
Is there an API function or this will require custom coding?
I'm finding something like this recently, none.
  • wxListCtrl
    support virtual mode
    no native row header
  • wxGrid
    support native row header
    no virtual mode
I don't understand you argument.
On Windows wxListCtrl supports a native header. In fact the whole control on Windows is native - it's just a wrapper around a native list control.
wxGrid does not need to be virtual. It can handle big number of data by itself. And row header is of course not native - the whole control is generic.

So please elaborate what you mean.

Thank you.
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

ONEEYEMAN wrote: Tue Oct 15, 2019 4:52 am wxGrid does not need to be virtual. It can handle big number of data by itself. And row header is of course not native - the whole control is generic.
So please elaborate what you mean.
If wxGrid supports huge data, it's a plus.

But I still prefer virtual mode of wxListCtrl/wxListView, reason:
  • the implementation is elegant
  • I don't know how wxGrid is implemented to support big data, but I can say explicit virtual mode can win in some cases,
    because in explicit virtual mode, functions, like virtual OnGetItemText, have the knownledge to locate the item for displaying most efficiently.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by ONEEYEMAN »

Hi,
How huge is a "huge"?
Are we talking Google-level data or?

wxGrid suppose to mimic the behavior of a spreadsheet.

Thank you.
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

ONEEYEMAN wrote: Tue Oct 15, 2019 12:26 pm How huge is a "huge"?
Are we talking Google-level data or?
I don't known how big the data should be to show significant difference between wxListCtrl (virutal mode) and wxGrid.
wxGrid may be efficient enough for common big data.
So huge data for testing only.
The result might be one is easier to use (less code), one is more professional (ready to be most efficient, and elegant interface).
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by doublemax »

Technically wxGrid is always virtual, it just uses a simple default wxGridTableBase as data source which is just an array of array of strings. Therefore random access to cell contents is fast.
Use the source, Luke!
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

doublemax wrote: Tue Oct 15, 2019 1:43 pm Technically wxGrid is always virtual, it just uses a simple default wxGridTableBase as data source which is just an array of array of strings. Therefore random access to cell contents is fast.
wxGrid is professional inside, and meet the demand.
However no virtual mode interface, no support for special knowledge or sophisticated design to accelerate data acessing.
Though no demands for that big data, not cool enough. :lol:
BTW, two copies of data (one in wxGrid object, one out of it) might be inconvenient.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by ONEEYEMAN »

Hi,
Let me repeat it - wxGrid by definition IS virtual.

Thank you.
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

ONEEYEMAN wrote: Tue Oct 15, 2019 3:24 pm Let me repeat it - wxGrid by definition IS virtual.
Yes.

Just for technic, for example, 10^10 rows * 10^10 columns, common random access may not be efficient enough.
Then a sophisticated solution in demand:
  • use multithread to locate the data for displaying
  • most recent used data searched first
  • any other accelerating methods that depends on the data
These might be done in virtual OnGetCellText.

Though no demands for this practically, it still has a chance to make things a little faster.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by doublemax »

These might be done in virtual OnGetCellText.
The "virtuality" happens by deriving from wxGridTableBase and then setting it with wxGrid::SetTable().

https://docs.wxwidgets.org/trunk/classw ... 2dd2cfb972
Use the source, Luke!
Ronald
Super wx Problem Solver
Super wx Problem Solver
Posts: 306
Joined: Mon Mar 05, 2018 4:17 am

Re: Hoa to display row number in a wxListCtrl of type wxLC_REPORT virual mode?

Post by Ronald »

doublemax wrote: Tue Oct 15, 2019 3:52 pm The "virtuality" happens by deriving from wxGridTableBase and then setting it with wxGrid::SetTable().
https://docs.wxwidgets.org/trunk/classw ... 2dd2cfb972
It's great.

BTW, wxGridTableBase is not as a base class of wxGrid,
it's ok, wxGrid is not intended to be derived for virtual mode.

Thanks
Post Reply