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 » CExtGridCellNumber question/broblem Collapse All
Subject Author Date
Offer Har Mar 26, 2008 - 3:08 PM

Dear Support,


I have a CExtGridCellNumber cell, which I need to validate on edit (not min-max, but agains other cells values). I over-ride OnInplaceControlTextInputVerify, but this function is not called when the spin buttons are pressed.


Note that I do not want to disable the spins (OnQueryEnabledIncrement and OnQueryEnabledDecrement), but to catch the event when the number is changed, because I need to display an informative message when this invalid case happens.


Regards,


Ron.


 

Technical Support Apr 5, 2008 - 9:49 AM

There are two options at the moment.

1) You can override the CExtGridCell::OnButtonPressing() virtual method. Please take a look at the original method’s code. In this method you can get access to the row and column number. There you can also find invocations of OnValueIncrement() and OnValueDecrement() methods. You can additionally put there your code.

2) When you press spin buttons the cell becomes focused, so if you are using a single row/cell selection model, you can use the CExtGridBaseWnd::FocusGet() method to get the focused row/column in the grid window. This method returns a CPoint object with the cell’s coordinates.

Offer Har Apr 5, 2008 - 10:14 AM

Dear Support,


Can you please add for the coming version passing of the parameters of grid, row & cell  to the OnValueIncrement() and OnValueDecrement() methods? If you say they are invoked from the the CExtGridCell::OnButtonPressing()  method, which does contain this information it does not seems to be too complicated. This is what I intend to do myself... If you want I can check it out and let you know if it works.


Ron.

Technical Support Apr 10, 2008 - 7:34 AM

We have modified grids code. Here are the details:

modified in CExtGridCell:
            virtual bool OnQueryEnabledIncrement(
                        const CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        ) const;
            virtual bool OnQueryEnabledDecrement(
                        const CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        ) const;
            virtual bool OnValueIncrement(
                        CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        );
            virtual bool OnValueDecrement(
                        CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        );
            virtual bool OnQueryButtonInfo(
                        INT nButtonType,
                        CExtGridWnd * pWndGrid = NULL,
                        LONG nColNo = 0,
                        LONG nRowNo = 0,
                        INT nColType = 0,
                        INT nRowType = 0,
                        bool * p_bEnabled,
                        bool * p_bPressed = NULL,
                        bool * p_bStayPressed = NULL,
                        UINT * p_nTimerElapseValue = NULL
                        ) const;
            bool IsButtonEnabled(
                        INT nButtonType, // e_button_type_t
                        CExtGridWnd * pWndGrid = NULL,
                        LONG nColNo = 0,
                        LONG nRowNo = 0,
                        INT nColType = 0,
                        INT nRowType = 0,
                        ) const;
            bool IsButtonPressed(
                        INT nButtonType, // e_button_type_t
                        CExtGridWnd * pWndGrid = NULL,
                        LONG nColNo = 0,
                        LONG nRowNo = 0,
                        INT nColType = 0,
                        INT nRowType = 0,
                        ) const;
            bool IsButtonStayPressed(
                        INT nButtonType, // e_button_type_t
                        CExtGridWnd * pWndGrid = NULL,
                        LONG nColNo = 0,
                        LONG nRowNo = 0,
                        INT nColType = 0,
                        INT nRowType = 0
                        ) const;

modified in CExtGridCellVariant:
            virtual bool OnValueIncrement(
                        LPVARIANT pvarValue,
                        CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        );
            virtual bool OnValueDecrement(
                        LPVARIANT pvarValue,
                        CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType
                        );

modified in CExtGridCellComboBox::
            void _DoItemsIterate( 
                        CExtGridWnd & wndGrid,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType,
                        HWND hWndInplaceControl,
                        bool bNext, 
                        bool bSetSel = false 
                        );

added into CExtGridWnd:
            virtual bool OnGridHookCellQueryEnabledIncrement(
                        LONG nColNo,
                        LONG nRowNo,
                        LONG nColType,
                        LONG nRowType,
                        const CExtGridCell & _cell,
                        bool & bEnabled
                        ) const;
            virtual bool OnGridHookCellQueryEnabledDecrement(
                        LONG nColNo,
                        LONG nRowNo,
                        LONG nColType,
                        LONG nRowType,
                        const CExtGridCell & _cell,
                        bool & bEnabled
                        ) const;
            virtual bool OnGridHookCellValueIncrement(
                        LONG nColNo,
                        LONG nRowNo,
                        LONG nColType,
                        LONG nRowType,
                        CExtGridCell & _cell,
                        bool & bResult
                        );
            virtual bool OnGridHookCellValueDecrement(
                        LONG nColNo,
                        LONG nRowNo,
                        LONG nColType,
                        LONG nRowType,
                        const CExtGridCell & _cell,
                        bool & bResult
                        );
            virtual bool OnGridHookCellQueryButtonInfo(
                        INT nButtonType,
                        const CExtGridCell & _cell,
                        LONG nColNo,
                        LONG nRowNo,
                        INT nColType,
                        INT nRowType,
                        bool * p_bEnabled,
                        bool * p_bPressed,
                        bool * p_bStayPressed,
                        UINT * p_nTimerElapseValue,
                        bool & bRetVal
                        ) const;


Technical Support Mar 28, 2008 - 6:07 AM

In this case, you can override OnValueIncrement() and OnValueDecrement() virtual methods instead of OnQueryEnabledIncrement() and OnQueryEnabledDecrement() .

Offer Har Mar 28, 2008 - 6:09 AM

As I wrote before - I need to do cross-cells validations, and these function do not contain the information such as the col and row number and the grid ref, like the other functions:


I would like to add that over-riding OnValueDecrement will not do, because I need information like in OnInplaceControlTextInputVerify - the row index, and the grid, because this I need to compare data between cells.

Technical Support Mar 27, 2008 - 2:09 PM

You can move your validation code in one function that returns a Boolean result. Then override all three virtual methods OnInplaceControlTextInputVerify(), OnQueryEnabledIncrement() and OnQueryEnabledDecrement() and insert invocation of your validation function there. Pass the cell value to this function and return false if the value is non-valid and true otherwise. Then using the result, you will be able to choose what you need to do further in the overridden virtual methods.

Offer Har Mar 27, 2008 - 3:46 PM

This implementation is problematic - I think that all user’s inputs should be handles in the same way.


Why isn’t  OnInplaceControlTextInputVerify called when the spin control buttons are pressed? This will solve all the problems.


Let me know how fast you can implement this, or at least suggest an alternative solution, as this is of high urgency for us.


Regards,


Ron.

Offer Har Mar 27, 2008 - 2:12 PM

I wrote that OnQueryEnabledIncrement and OnQueryEnabledDecrement  are not good for me.


The validation is extensive, and expensive in resources. so I want to do only when the button is clicked, not when the GUI decide to validate ths arrows, this is what I wrote above:


Note that I do not want to disable the spins (OnQueryEnabledIncrement and OnQueryEnabledDecrement), but to catch the event when the number is changed, because I need to display an informative message when this invalid case happens.


 

Technical Support Mar 31, 2008 - 12:09 PM

We assume that built-in up/down buttons of grid cells can be used differently and not only for editing cells. The CExtGridCell::OnQueryEnabledIncrement() virtual method is called before CExtGridCell::OnValueIncrement() and CExtGridCell::OnQueryEnabledDecrement() before CExtGridCell::OnValueDecrement() virtual method. So, both the CExtGridCell::OnQueryEnabledIncrement() and CExtGridCell::OnQueryEnabledDecrement() virtual methods are verification methods which also affect the disabled state of up and down buttons inside the up/down cell part.


Offer Har Mar 31, 2008 - 12:15 PM

Dear Support,


Please - I need to get the event when a click is done and I need to get the grid and row & col information.


An alternative is that when the value in the numeric cell is modified I will be able to catch it and get the grid row & col.


I hope that you undersatdn that something is missing here.....


I need to know when my cell’s value was changed and do so validations - and the only time I cannot do it is when the spin buttons are pressed.


Ron.

Offer Har Mar 26, 2008 - 4:04 PM

I would like to add that over-riding OnValueDecrement will not do, because I need information like in OnInplaceControlTextInputVerify - the row index, and the grid, because this I need to compare data between cells.