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 General Discussion » Own text in CExtGridCellColor Collapse All
Subject Author Date
Mateusz Zawilo Jun 5, 2008 - 4:25 AM

Hello!


Is there a possibility to add own text ( instead of automaticly generated ) to this kinf of grid cell? Or I’ll have to create my own class derived from CExtGridCell?


Mateusz


 

Mateusz Zawilo Jun 11, 2008 - 4:27 AM

I’m currently trying to implement such class:



class  CExtGridCellTextColor : public CExtGridCellColor

{

    DECLARE_SERIAL( CExtGridCellTextColor );

    IMPLEMENT_ExtGridCell_Clone( CExtGridCellTextColor, CExtGridCellColor);



    CExtGridCellTextColor( CExtGridDataProvider * pDP = NULL);

   



public:

    ~CExtGridCellTextColor(void);

    virtual void OnFormatCellText( CExtSafeString &strText, COLORREF clr );

   

};


 


#include "StdAfx.h"

#include ".\extgridcelltextcolor.h"



IMPLEMENT_SERIAL( CExtGridCellTextColor, CExtGridCellColor, VERSIONABLE_SCHEMA|1 );



CExtGridCellTextColor::CExtGridCellTextColor( CExtGridDataProvider * pDP /* = NULL */ )

    : CExtGridCellColor( pDP )

   

{

   

}



CExtGridCellTextColor::~CExtGridCellTextColor(void)

{

}



void CExtGridCellTextColor::OnFormatCellText( CExtSafeString &strText, COLORREF clr )

{

   

    if( clr == RGB( 100, 100, 100 ) )

    {

        strText = L"SomeText";

    }

   

}


but function "OnFormatCellText" is never beeing called ( constructor is ).


 

Technical Support Jun 13, 2008 - 3:46 AM

Here is the declaration of OnFormatCellText:

virtual void OnFormatCellText(
            CExtSafeString & strText,
            COLORREF clr
            ) const;
As you can see the signature of your overridden method is different. You missed the const attribute. That is why you method is not invoked.

Mateusz Zawilo Jun 11, 2008 - 2:39 AM

Thanks!

Technical Support Jun 9, 2008 - 4:54 AM

The color cell’s text is generated in the CExtGridCellColor::OnFormatCellText virtual method. You can create your own CExtGridCellColor-derived class and override this method there.