IonicWind Software

IWBasic => General Questions => Topic started by: Andy on May 25, 2019, 05:26:02 am

Title: List view column count
Post by: Andy on May 25, 2019, 05:26:02 am
Hi,

Yes I'm still here!

I was wondering how I can count the number of columns a list view has?

Can this be done any one?

Thanks,
Andy.
Title: Re: List view column count
Post by: Egil on May 25, 2019, 06:41:07 am
Hi Andy,

According to the IWB Users Guide this is the way to do it:

Quotecount = CONTROLCMD( window | dialog, ID, @LVGETCOUNT)

Use this function to retrieve the total number of items in the list view control


Good luck!

Egil
Title: Re: List view column count
Post by: Andy on May 25, 2019, 07:11:09 am
Thanks Egil,

But that only gives you how many lines in a list view, not how many columns a list view has.

Andy.
:)
Title: Re: List view column count
Post by: Egil on May 25, 2019, 08:17:32 am
Sorry andy,
Did not read your questiopn properly....

These two links should give you an idea how to do it:

https://stackoverflow.com/questions/33281164/how-to-get-the-number-of-columns-in-a-list-control (https://stackoverflow.com/questions/33281164/how-to-get-the-number-of-columns-in-a-list-control)

https://www.codeguru.com/cpp/controls/listview/columns/article.php/c997/Getting-the-number-of-columns-in-the-report-view.htm (https://www.codeguru.com/cpp/controls/listview/columns/article.php/c997/Getting-the-number-of-columns-in-the-report-view.htm)


Good luck!
Egil
Title: Re: List view column count
Post by: Andy on May 26, 2019, 01:28:51 am
Thanks every one!

Here is the answer:

Code Select
uint hProgress = GETCONTROLHANDLE(WinIn,LV)       'Handle to the List view control.
UINT HDR=SendMessage(hProgress,LVM_GETHEADER,0,0) 'Handle to the List view header.
INT Columns=SendMessage(HDR,HDM_GETITEMCOUNT,0,0) 'Number of columns in the List view.

Andy.
 :)