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 » How to Enable/Disable a grid cell button without overriding the cell? Collapse All
Subject Author Date
Offer Har Apr 4, 2008 - 6:03 AM

I have a lot of cells, and some of them may or may not have buttons, some of these buttons may or may not be enabled.


I want to do all this in the grid level, because the type of the cells is not important, and I don’t want to override all cell types, more then this, I don’t know what the cell type is going to be - this is a generic mechanism. I saw OnQueryButtonInfo for this, but this is a function at the cell level. I think there should be a style like __EGCS_BUTTON_ELLIPSIS_DISABLED which one could set to a cell, and will disable the ellipsis button.


Thanks.

Technical Support Apr 8, 2008 - 12:58 PM

Why don’t you create a template with an overridden OnQueryButtonInfo method? Such a template can be applied to any cell class.

template < class _BC >
class TEllipsisButtonGridCell : public _BC
{
public:
            TEllipsisButtonGridCell(
                        CExtGridDataProvider * pDataProvider = NULL
                        )
                        : _BC( pDataProvider )
            {
                        ASSERT_VALID( this );
            }

            TEllipsisButtonGridCell( const CExtGridCell & other )
            {
            }

            virtual bool OnQueryButtonInfo(
                        INT nButtonType,
                        bool * p_bEnabled,
                        bool * p_bPressed = NULL,
                        bool * p_bStayPressed = NULL,
                        UINT * p_nTimerElapseValue = NULL
                        ) const
            {
                        ...
                        ...
                        ...
            }

            virtual CExtGridCell * Clone(
                        IMalloc * pMalloc = NULL
                        ) const
            {
                        ASSERT_VALID( this );
                        if( pMalloc == NULL )
                        {
                                   try
                                   {
                                               CExtGridCell * pOther =
                                                           new TEllipsisButtonGridCell < _BC >
                                                                       (           (           const_cast
                                                                                              < TEllipsisButtonGridCell < _BC > * >
                                                                                              ( this )
                                                                                  )
                                                                                  -> DataProviderGet()
                                                                       );
                                               ASSERT( pOther != NULL );
                                               if( pOther != NULL )
                                               {
                                                           ASSERT_VALID( pOther );
                                                           pOther->Assign( *this );
                                                           ASSERT( pOther->DataProviderGet() == DataProviderGet() );
                                               } // if( pOther != NULL )
                                               return pOther;
                                   } // try
                                   catch( CException * pException )
                                   {
                                               ASSERT( FALSE );
                                               pException->Delete();
                                   } // catch( CException * pException )
                                   catch( ... )
                                   {
                                               ASSERT( FALSE );
                                   } // catch( ... )
                                   return NULL;
                        } // if( pMalloc == NULL )
                        CExtGridCell * pOther =
                                   new (pMalloc, false) TEllipsisButtonGridCell < _BC >
                                               (           (           const_cast
                                                                       < TEllipsisButtonGridCell < _BC > * >
                                                                       ( this )
                                                           )
                                                           -> DataProviderGet()
                                               );
                        ASSERT( pOther != NULL );
                        if( pOther != NULL )
                        {
                                   ASSERT_VALID( pOther );
                                   pOther->Assign( *this );
                                   ASSERT( pOther->DataProviderGet() == DataProviderGet() );
                        } // if( pOther != NULL )
                        return pOther;
            }

}; // class TEllipsisButtonGridCell
Then you will be able to decorate any class:
TEllipsisButtonGridCell < CExtGridCell > * pCell


Offer Har Apr 8, 2008 - 1:03 PM

Dear Support,


Why can’t you add this to the base cell class? I think that if you add the functionality of buttons by using a style to all cells, you should add the enable/disable style in the same place fro that button.


I think it will benefit all your users.


Using too much template decorations for such simple tasks makes to code even more complex.


Ron.

Technical Support Apr 11, 2008 - 7:10 AM

We added the following cell extended styles:

// disable ellipsis button
#define __EGCS_EX_BUTTON_ELLIPSIS_DISABLED                          0x00010000L
// disable dropdown button
#define __EGCS_EX_BUTTON_DROPDOWN_DISABLED                     0x00020000L
// disable up button
#define __EGCS_EX_BUTTON_UPDOWN_UP_DISABLED                   0x00040000L
// disable down button
#define __EGCS_EX_BUTTON_UPDOWN_DOWN_DISABLED              0x00080000L
You can apply such a style in the following way:
pCell->ModifyStyleEx( __EGCS_EX_BUTTON_UPDOWN_UP_DISABLED );


Offer Har Apr 11, 2008 - 7:16 AM

Thank you very much


When is 2.83 estimated to be released?

Technical Support Apr 11, 2008 - 9:53 AM

We still have not passed cannot path the pre-release testing/debugging stage, which is the reason for this delay.