Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - [SOLVED] SetFocusedRow broken in 15.01
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] SetFocusedRow broken in 15.01

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


Joined: 04 March 2008
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashk Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] SetFocusedRow broken in 15.01
    Posted: 09 February 2011 at 1:13pm
After updating to 15.01, CXTPReportControl::SetFocusedRow does not seem to work any more. The selected row does not change. This worked fine in the beta version.

Is there a different function I should use to programmatically select a specific row?

Back to Top
flashk View Drop Down
Groupie
Groupie


Joined: 04 March 2008
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashk Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2011 at 3:06pm
I was able to fix the issue by reverting the changes made to the SetFocusedRow function since the beta version. Basically, I modified the following section of the function from:
if (nFocusedRow != pRow->GetIndex() || pRow->GetType() != nFocusedRowType)
{
    CMDTARGET_ADDREF(pRow);

    BOOL bApply = OnFocusChanging(pRow, NULL);

    if (pRow->m_dwRef == 1) // Removed
        bApply = FALSE;

    CMDTARGET_RELEASE(pRow);

    if (!bApply)
        return FALSE;
}
to:
if (nFocusedRow != pRow->GetIndex() || pRow->GetType() != nFocusedRowType)
{
    if (!OnFocusChanging(pRow, NULL))
        return FALSE;
}

Back to Top
flashk View Drop Down
Groupie
Groupie


Joined: 04 March 2008
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote flashk Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2011 at 3:30pm
I figured out why the newer version is broken. The CMDTARGET_RELEASE macro not only decrements the reference count, but also sets the pointer to 0.
#define CMDTARGET_RELEASE(x) if (x) { x->InternalRelease(); x = 0;}
I don't think this is the intended behavior. The line:
CMDTARGET_RELEASE(pRow);
should be changed to:
pRow->InternalRelease();
This fixed the issue for me.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2011 at 2:53am
Thanks, fix is comming.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Alex G. View Drop Down
Groupie
Groupie


Joined: 22 December 2004
Location: Germany
Status: Offline
Points: 74
Post Options Post Options   Thanks (0) Thanks(0)   Quote Alex G. Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2011 at 3:24am

Will there be a bug release ?

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 10 March 2011 at 12:48pm
already released
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.203 seconds.