Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Does CExtGridWnd have a ItemGetByVisibleRowIndex() equivalent? Collapse All
Subject Author Date
Alastair Watts Nov 10, 2010 - 9:24 AM

 



I need to map the visible row index to the un-hidden row index, any ideas?


 


Alastair Watts Nov 15, 2010 - 5:48 AM

Thanks very much.  Interestingly I still get a compiler error with ’- nRowCountReserved

Technical Support Nov 15, 2010 - 7:36 AM

This is probably some compiler’s bug. You can split one line of code into several lines computing the same.

Alastair Watts Nov 12, 2010 - 5:06 AM


The line:


nDstRowNo = LONG( _DataProvider.MapV2RY( ULONG(nSrcRowNo) - nRowCountReserved ) – nRowCountReserved );


gives the compiler error: C2146: syntax error : missing ’)’ before identifier ’’


I’ve tried changing the brackets but just get negative values returned!


 


Technical Support Nov 13, 2010 - 8:24 AM

We are sorry. We mean:

nDstRowNo = LONG( _DataProvider.MapV2RY( ULONG(nSrcRowNo) + nRowCountReserved ) – nRowCountReserved );
We need to add the number of outer header rows first. Then we convert the data provider’s virtual row index into the real index. Finally we need to subtract the number of outer header rows first to get the plain data row index.

Alastair Watts Nov 11, 2010 - 2:53 AM

I want to map inner rows only - can you provide some sample code please.


 

Technical Support Nov 11, 2010 - 11:27 AM

Here is the sample code:

LONG nSrcRowNo = . . .
CExtGridWnd * pWndGrid = . . .
CExtGridDataProvider & _DataProvider = pWndGrid->OnGridQueryDataProvider();
LONG nDstRowNo = nSrcRowNo;
if( _DataProvider.MappingIsEnabledY() )
{
        ULONG nColCountReserved, nRowCountReserved;
        _DataProvider.CacheReservedCountsGet( &nColCountReserved, &nRowCountReserved );
         nDstRowNo = LONG( _DataProvider.MapV2RY( ULONG(nSrcRowNo) - nRowCountReserved ) – nRowCountReserved );
}

Technical Support Nov 10, 2010 - 11:56 AM

This information is stored inside the data provider decorated by the CExtMDP template class. The CExtMDP::MapV2RY() does what you need. Please note, the parameter and return value of this method is the plain index in entire row storage which is organized as the following sequence: header rows at top, then header rows at bottom, then data rows.