Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - (un)checking all rows of the selection
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

(un)checking all rows of the selection

 Post Reply Post Reply
Author
Message
inmaurik View Drop Down
Groupie
Groupie


Joined: 13 July 2007
Location: Netherlands
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote inmaurik Quote  Post ReplyReply Direct Link To This Post Topic: (un)checking all rows of the selection
    Posted: 29 May 2009 at 4:21am
I would like to be able to check/uncheck all rows of the selection in the ReportGrid.

In CXTPReportRecordItem::OnClick a XTP_NM_REPORT_CHECKED message is send but at that moment the selection is already removed by the SetFocusedRow statement in CXTPReportControl::OnLButtonUp.

Is there a way to achieve this functionality (like the Pending Changes view in Visual Studio) or can this be added to the next release because I see no way to prevent the removal of the selection if the user clicks the glyph area of the record item.
Product: Xtreme SuitePro (MFC) version 13.3.1
Platform: Windows 7 Enterprise (64bit)
Language: C++ (Visual Studio 2008 SP1)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2009 at 2:21pm

Need non-item related function (Control level) - SetSelectionState(int state) where state can be 0, 1 or 2 (tristate checkbox). But if row / record have more than one checkboxes? So need smth like SetSelectionState(int index, int state). And you need to have menu (fixed or context) or button for UI to call this function and different buttons for several checkboxes in row

I made this function (SetSelectionState) - be in 13.1
 
Another idea - you can implement support of RightButton click (this one keep selection)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2009 at 7:04pm
I add to ReportControl experimental flag to support checking with Right button mouse and keep selection same time. Is it enough for you? Or you want this click do some extend work: change check state of item you right click on and duplicate this state on all other same column items inside selection?
This is not difficult and we can add extra flag to allow or not such action extension
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 29 May 2009 at 7:20pm
Finally I implemented both flags and you can try to play with this feature in static sample
 
 
There are couple of columns with checkboxes in the right part - scroll if not see it.
Both flags set ON in this app so your action will extend for all selection
 
I also expose this feature in simplified form to ActiveX -  it set both flags with same value and return it if you ask
wndReportControl.AllowSelectionCheck = True
I also add accelerator Ctrl+A to select all records in Report Body
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2009 at 1:23am
Only now I recoginized that this is typo in demo file name - I will keep it for prev version and now upload new one:
 
 
Compare prev and last version in PreviewMode - it was a bug with Header Rows and nobody never report it!
Back to Top
inmaurik View Drop Down
Groupie
Groupie


Joined: 13 July 2007
Location: Netherlands
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote inmaurik Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2009 at 7:27am
Using the right-click to set the selection is not an option because our users are used to using the left button-click.

I however managed to get it working in the same way like Visual Studio 2008 Pending Changes with the current CodeJock version (13.0).

I have set AutoCheckItems to FALSE because I only want the check-box to be checked when the user clicks on the check box and not on the other part of the record item.

In the OnLButtonUp of my CXTPReportControl class I check if the clicked row = m_pSelectOnUpRow. If this is true and the user clicked on the check box area (I am using a helper function on my implementation of CXTPReportRecordItem), the m_pSelectOnUpRow is set to NULL and the focus is set to the clicked row (with bIgnoreSelection = TRUE).

The XTP_NM_REPORT_CHECKED message is handled by my CXTPReportControl class and sets the check state of all selected rows to the inversed value of the clicked row (only when the click is on the check box area).

The function SetSelectionState can be handy but does not complete the whole job. A function on CXTPReportRecordItem or CXTPReportRow to check if a point is in the check box area of the row/item would also be very usefull (e.g. HitCheckboxTest).

Product: Xtreme SuitePro (MFC) version 13.3.1
Platform: Windows 7 Enterprise (64bit)
Language: C++ (Visual Studio 2008 SP1)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.