Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - HOWTO: Setting focus after reload from DB?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Setting focus after reload from DB?

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO: Setting focus after reload from DB?
    Posted: 18 December 2012 at 5:09pm
Hi;

I'm populating the report control with data from a database table. These records are grouped by a single field.
Now I'm trying to implement a smart database reload function that restores the state of all rows in the control. This means the group expand state and the selected rows including the single focused row - as far as they still exist after executing the reload.
Due to the fact that CXTPReportControl::ResetContent() deletes all record and row collections, I'm unable to use these pointer after the reload. That's absolutely clear!
Selecting normal rows is no problem, but since group rows do not have any information inside (calling row->GetRecord() is NULL) I have no idea how to find the same group row AFTER the reload. So my question is: How can I mark a group row by a tag that i can use as a key to find the same group row in the reloaded control?
Did  I miss a callback when group rows are created or are there any functions around that help me in solving this issue?

TIA
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2013 at 2:03pm
Has really no one ever had the same to solve????
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2016 at 11:05am
Still no solution for this?
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2016 at 6:35am
Hi Martin,

I am not sure if I understand you right, but maybe you have a look at the Report Sample:

void CReportSampleView::OnAutoGrouping()
{
    if (GetReportCtrl().GetColumns()->GetGroupsOrder()->GetCount() == 0)
    {
        CXTPReportColumn* pColFrom = GetReportCtrl().GetColumns()->Find(COLUMN_FROM);

        GetReportCtrl().GetColumns()->GetGroupsOrder()->Clear();

        GetReportCtrl().GetColumns()->GetGroupsOrder()->Add(pColFrom);
    }
    else
    {
        GetReportCtrl().GetColumns()->GetGroupsOrder()->Clear();
    }
    GetReportCtrl().Populate();
}

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2016 at 7:21am
Hi;

thanks for your reply, but it is definitely NOT what I am looking or.
I want to expand group rows and modify their caption after refetching from database, but only those that were marked as to change before the reload happens.
Problem is that group rows have no records attached to them to put some kind of additional identity into.

But nevertheless, thanks!

M.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2016 at 7:56am
Two admittedly ugly ideas I can think of:

1) Every group row must have at least 1 child row, correct? If so, you could store information about the GroupRow in the first child row.

2) Every group row has a unique caption - you can use that as a key for a separate data structure that holds the GroupRow information that links back to your database.

Hey, I didn't say they were pretty ;)
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2016 at 8:17am
Hi Martin,

you could store the state of the CXTPReportGroupRow in a map
CMap<CString*, CString*, int, int> map;

before you delete ( ResetContent() ) them. After populating and grouping you scan again the Rows and if you match a GroupRow ( IsGroupRow() ) you look in your map for the right caption name and reset the state.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 01 September 2016 at 11:26am
Hi;

To 1) This is true, but the first child row may change between reload calls.
To 2) The Caption is generated by data out of the database. This content may change too!

Therefore both suggestions need more investigations by myself.

Anyway, thanks!

M.
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
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.156 seconds.