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 » Question about grid Collapse All
Subject Author Date
Paolo Giustinoni May 19, 2006 - 5:33 PM

Hello, I have one question about the grid..
There is some way to get a row (not an header row) of an CExtGridWnd "frozen", like a fixed row?

Thanks, Paolo

Technical Support May 20, 2006 - 10:43 AM

It is not entirely clear what you mean by a "frozen row". Please let us know more details about this.

Paolo Giustinoni May 21, 2006 - 9:44 AM

With "frozen row" I mean a row (or a column) that acts like a fixed row (or fixed column), in some place within the grid (not necessary at the top or left or right), so when you scroll the grid, the fixed row (or column) remain fixed, so this "frozen row"..
For example when I have a row with totals, the correct place is at the bottom of the grid, and when I scroll the grid, this row is always visible.

Technical Support May 22, 2006 - 4:20 AM

This can be done using header areas because it is possible to make header cells having a look of inner data cells. The frozen grid rows/columns as header row cells would always occupy some fixed part of the grid window in this case. If the number of frozen rows/columns in your case is enough large, then you can use two grid windows inside the splitter control and synchronize the scrolling and row widths/column heights in these grids. In any case, we can discuss your task in details and find the best solution.

Paolo Giustinoni May 22, 2006 - 6:08 AM

Thanks for your top-class support..
Before to discuss this issue, I have three other questions..
1) What virtual function I have to override to understand when the user has began to edit the cell?
2) What function to understand when the user has finished to edit?
3) I have, in my test project, a dialog box with a recordset as private member and a grid filled with field values from this recordset. When I edit a cell, I have to update the recordset. I understand that I have to derive a new cell and override some functions to respond to these events, and from the cell point-of-view I have direct access to the grid window. What’s the best strategy to communicate with the dialog (that hold the recordset)? Sending messages from the cell to the dialog or to the grid and then from the grid to the dialog? Calling a dialog public function from the cell?

Thanks in advance. Paolo

Technical Support May 23, 2006 - 2:40 AM

You can do this by using only virtual methods of the CExtGridWnd class. Thers is no need in coding any cell objects. Here is an editable version of the AdoRecordsetView sample. You can override the following virtual method to know whether the changes made during editing were commited or cancelled:

virtual void OnGridCellInplaceControlTextInputComplete(
       CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       __EXT_MFC_SAFE_LPCTSTR sTextNew,
       bool bSaveChanges
       );
The bSaveChanges parameter indicates whether the result of editing was applied to the cell object. There are several type-specific input complete events that can be caught with these virtual methods:
virtual void OnGridCellInplaceControlDateTimeInputComplete(
       CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       COleDateTime dtNew,
       bool bSaveChanges
       );
virtual void OnGridCellInplaceControlSliderInputComplete(
       CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       INT nPosNew,
       bool bSaveChanges
       );
virtual void OnGridCellInplaceControlIPAddressInputComplete(
       CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       DWORD dwIPAddressNew,
       bool bSaveChanges
       );
You can control the editing process with this method:
virtual bool OnGridCellInplaceControlTextInputVerify(
       const CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       __EXT_MFC_SAFE_LPCTSTR sTextInitial,
       __EXT_MFC_SAFE_LPCTSTR sTextPrevious,
       CExtSafeString & sTextNew,
       bool bEndEdit
       );
If the bEndEdit parameter is false, then the method is invoked each time when the user changes text in the editor. If the bEndEdit parameter is true, the editing is complete and you can return true or false depending on whether you want to apply or cancel the results of editing. Of course, you can use this method when the editing is complete. There are also several type-specific methods of this kind:
virtual bool OnGridCellInplaceControlDateTimeInputVerify(
       const CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       COleDateTime dtInitial,
       COleDateTime dtPrevious,
       COleDateTime & dtNew,
       bool bEndEdit
       );
virtual bool OnGridCellInplaceControlSliderInputVerify(
       const CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       INT nPosInitial,
       INT nPosPrevious,
       INT & nPosNew,
       bool bEndEdit
       );
virtual bool OnGridCellInplaceControlIPAddressInputVerify(
       const CExtGridCell & _cell,
       HWND hWndInplaceControl,
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       DWORD dwIPAddressInitial,
       DWORD dwIPAddressPrevious,
       DWORD & dwIPAddressNew,
       bool bEndEdit
       );
The following virtual method allows you to catch the event when editing begins:
virtual bool OnGbwBeginEdit(
       LONG nVisibleColNo,
       LONG nVisibleRowNo,
       LONG nColNo,
       LONG nRowNo,
       INT nColType,
       INT nRowType,
       const RECT & rcCellExtra,
       const RECT & rcCell,
       const RECT & rcInplaceControl,
       bool bContinueMsgLoop = true
       );