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 » Feature request Collapse All
Subject Author Date
David Skok Oct 12, 2006 - 12:55 PM

Or maybe a method already exists...

I use a ReportGridWnd with the following styles...

#define __ENABLE_CELLEDITING_BSE_STYLES__     ( __EGWS_BSE_EDIT_RETURN_CLICK     |__EGWS_BSE_EDIT_SINGLE_FOCUSED_ONLY     |__EGWS_BSE_EDIT_DOUBLE_LCLICK     |__EGWS_BSE_EDIT_CELLS_INNER |__EGWS_BSE_EDIT_AUTO |__EGWS_BSE_BUTTONS_IN_FOCUSED_ROW     )

SiwModifyStyle( 0, __EGBS_SFB_MASK );
SiwModifyStyle( __EGBS_GRIDLINES | __EGBS_SFM_CELLS_V | __EGBS_LBEXT_SELECTION, __EGBS_SFB_FULL_ROWS );
BseModifyStyle( __ENABLE_CELLEDITING_BSE_STYLES__, __EGWS_BSE_BUTTONS_PERSISTENT );

In short: multiple row selection, full row highlighted, auto editing etc.

The functionality I am implementing is that when multiple rows are selected, any edit to a cell is applied to the same column of all selected rows. Right now if VK_LEFT or VK_RIGHT is pressed, it will automatically unselect rows other than the currently focused row. The functionality that I would like is all selected rows remain selected if I switch columns in the selected row. All other functionality remains the same, that is, when the focus row is changed through either VK_UP/DOWN with bNoModifiers == false it will still unselect everything but the focused row, same for the mouse.

Your help is greatly appreciated,

Thanks

Technical Support Oct 13, 2006 - 7:57 AM

The CExtGridWnd class supports the functionality that restores the selection after modifying grid cells in sorted columns. This feature is not supported in the CExtReportGridWnd class because it rebuilds its tree nodes after a grid cell is modified. To restore the selection is this case would be very ineffective. The super grid window in MS Outlook does not restore the selection either. You can restore the selection manually by keeping a CExtReportGridItem * pointer for each selected data row in the report gird. After the sort order is updated, you need to ensure all the kept report row pointers have expanded parent report rows first and then select the data rows which were selected previously.

David Skok Oct 13, 2006 - 2:39 PM

I forgot to mention that CExtGridCell::OnInplaceControlTextInputVerify is overridden and always returns false. I hijack the input here and send it over a wire. If the device at the end of the wire completes the edit it reflects a message back and my app effects the text update in the report. I understand what you mean about sort not being in sync. Sorting is allowed at this point however is not terribly important and in fact may disabled in the future.

David Skok Oct 13, 2006 - 9:02 AM

Thank you for the reply.

I think you misunderstood my request. I was not asking for selections to remain when sorting but rather selections to remain in a case where multiple rows selected, full rows highlighted enabled. When the user selects rows then begins editing they may move from column to column (within the same last selected row) without clearing the selections they made. The way it is now, if they went through the report selecting rows then edited a column the selections remain. If they use the right or left arrow key to focus a different column in the same row they lose their selected rows and are forced to jump around the report selecting the same rows all over then edit another column.

When I first traced through the lib code it appeared that there were no functions that I could override and modify to produce the effect I wanted. I spent more time and stepped through again and discovered that I can easily do what I want as follows (in case others are interested).

in a decendent of CExtReportGridWnd declare:

bool SelectionsCanChange; // added, init to true in constructor!
bool SetSelectionsCanChange( bool setting ) // added
{ bool sel = SelectionsCanChange; SelectionsCanChange = setting; return sel; }

virtual bool OnGbwSelectionCanModify() // overrides CExtGridBaseWnd version
{
ASSERT_VALID( this );
return SetSelectionsCanChange( true );
}


In a decendent of CExtGridCell that will be used in the ReportGrid add...

virtual bool OnKey(
    CExtGridWnd & wndGrid,
    bool bKeyDownEvent, // true - key-down event, false - key-up event
    UINT nChar, // virtual key code
    UINT nRepCnt, // key-down/key-up press count
    UINT nFlags // key-down/key-up event flags
    );

in new version of OnKey...

if( bKeyDownEvent )
{
if( nChar == VK_LEFT || nChar == VK_RIGHT )
{
CExtReportGridWndDecendent *srpt = (CExtReportGridWndDecendent *) &wndGrid;
if( srpt->IsKindOf( RUNTIME_CLASS( CExtReportGridWndDecendent ) ) )
srpt->SetSelectionsCanChange( false );
}
break;
}
call the original version of OnKey....

The above overrides seem to produce the desired effect without causing harm elsewhere.






Technical Support Oct 16, 2006 - 12:50 PM

Thank you for the interesting feature request. It is really reasonable, but for the report grid only -- not for any generic grid. Currently the report grid resets multiple selection to a single row with the focused cell absolutely the same like in MS Outlook. We can add optional selection keeping in this case.