Sorry, crucial bug found in 13.1 |
Post Reply | Page 12> |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 17 June 2009 at 2:44pm |
This code works for ONE row. If more rows are selected, the records are screwed and we later get a crash.
CXTPReportRecords* pMoveRecords = new CXTPReportRecords(TRUE);
if (_GetSelectedRows(pMoveRecords))
{
int nextIndex = pMoveRecords->GetAt(0)->GetIndex() + 1;
GetRecords()->Move(nextIndex, pMoveRecords);
Populate();
_SelectRows(pMoveRecords);
RedrawControl();
}
CMDTARGET_RELEASE(pMoveRecords);
Example:
Row A - selected
Row B - selected
Row C
Row D Then I execute "Move down" as above. This is the result:
Row C
Row A - selected
Row A
Row B - selected
Row D
When removing the strange record we get a crash here:
_AFXDISP_INLINE DWORD CCmdTarget::InternalAddRef()
{ ASSERT(GetInterfaceMap() != NULL); return InterlockedIncrement(&m_dwRef); }
|
|
PokerMemento - http://www.pokermemento.com/
|
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
probably related to fix for
http://forum.codejock.com/forum_posts.asp?TID=13113 I had my doubts about that fix, given the likely implementation of Move(). With CArray, moving down 1 means you take a record and insert it before the following record (which is therefore inserted back into the same place). In some ways, having to move down 2 makes sense if you consider that any array insert will move the following elements down 1 in itself. Adrien |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I can live with that. Rollback? |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Can you please comment on this? I must go back to 13.0 if this function is left in its current state :(
|
|
PokerMemento - http://www.pokermemento.com/
|
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
I submitted a support ticket for a similar problem in the ActiveX version:
http://forum.codejock.com/forum_posts.asp?TID=14556 It sounds likely that the source of these problems is the same. AFAIK Mark is working on a fix for this (not sure about an ETA though, sorry). |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
this is from ActiveX post: This is a bug in selection with SHIFT pressed. If you will use (before fix) CTRL to select rows one by one - all will be fine. There is no bugs in Move call - only wrong selection in some cases (explanation of bug: selection add duplicated record and crach while releasing already released this duplicated record)
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Obviously, shift-clicking causes a crash. That's not acceptable. What should I do to avoid the crash then? A patch is needed.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You can get updated (selection, moving, some minor improvements) source here https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
and refresh your version
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Thanks. Will try this in 12h :P
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
zaksoft
Senior Member Joined: 05 June 2003 Location: Italy Status: Offline Points: 162 |
Post Options
Thanks(0)
|
New sources are dated 29 and 30 ( of july ) ....
|
|
VS2022 - MFC MBCS Statically linked
XTP 23.1 Static Link --------------------------------------------------------- Davide Zaccanti - ZakSoft - www.zaksoft.com |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Result of testing evaluation expiration same time. Use touch and change to current. It should not prevent you to build updated dll and app
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Fresh demo with persist selection including child selection here - https://forum.codejock.com/uploads/DemoVersion/ReportSampleStaticProto.rar |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Seriously, if a reproducible bug is reported and you fixed and tested it, then just say "Fixed". Though the build samples are nice to have, please remember that customers spend time testing releases, coders/testers spend time testing internal builds.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
And this is a bad thing as when we release beta - we expect feedback to have a clean release. We are not M$ and we don't have (enough!?) testers so it is in common interest to help us in testing. We are not working on one component only and use a lot of time answering your issues and helping you (sometimes to fix your app-level bugs even not related to CJ components)...
Plus each fresh version of published static app demonstrate new features like in fresh https://forum.codejock.com/uploads/DemoVersion/ReportSampleStaticExt.rar you can use group box hierarchy show state of selection on different levels with cascade effect
And this sample https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar show perfect print/printpreview for real app - not for toy with all fit in one page as was before 13.1
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Bug? WYSIWYG print mode. When double-clicking items they react... e.g. bold becomes normal.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
No - this is reaction in ReportSampleView... sample code on double-click (you can see same reaction when WYSIWYG if OFF - it irrelevant)
and ReportPaneView don't have this effect! Thanks for testing!
// Handles double clicking ReportControl item - If "Read" attribute is False, changes it to True
void CReportSampleView::OnReportItemDblClick(NMHDR * pNotifyStruct, LRESULT * /*result*/){XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct; if (pItemNotify->pRow){TRACE(_T( "Double Click on row %d\n"),pItemNotify->pRow->GetIndex()); CMessageRecord* pRecord = DYNAMIC_DOWNCAST(CMessageRecord, pItemNotify->pRow->GetRecord()); if (pRecord){ if (pRecord->SetRead()) GetReportCtrl().Populate();}}} |
|
Erin
Newbie Joined: 23 July 2009 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
hi~~
I've updated version 13.1 with this source updated files on June/2009 There's a bug about CXTPReportRecords::Move downward need to be added one more index. It's resolved in version 13.1 but appear AGAIN in this updated files. BTW. This update files resolved a bug in version 13.1 though, when drag CXTPSelectedRows downward need to be add one more index like CXTPReportRecords::Move one. It will be a great help if these two bugs are resolved. Thanks!! |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Get fresh update and try again please - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
This is working progress archive and the viersion you referenced could be some intermmidiate.
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Will try it next week at the playa :P.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Does NOT work. Crash is gone, but "Move down" does nothing (haven't changed my code, just updated with the provided sources).
When can we expect 13.1.1? I think a patch release is really needed...
Also, this code suffers from another bug (perhaps already fixed?):
A
B --> Drag-copy to another report control.
C
D
Now select A-D using Shift+click from A to D. Item C is not selected!!!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Bug #2:
There is a small checkbox on my group row. Have never seen it before...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Make a simple research to understand it's purpose
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You asked about test-cases and Fixed conclusion. I don't have testers to conform it so I can only confirmed that
works well for both your recent complains - so even you have a problems in your app or you did not build recent dll
https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar
both updates now supported drag and drop for sorted case (like Vista Windows Explorer) - need to use flag ReportControl.SortedDragDrop = True (VB)
or GetReportCtrl().m_bSortedDragDrop = TRUE; (MFC)
updated sample to see this feature - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
My code worked flawlessly in XTP 13.0, so it can't be it.
I'll download the latest rar package tonight and see if I can get it working.
Sorry, I don't follow here.
What is "m_bSortedDragDrop"? If I select A,C and drag+drop them, why would I need to set a specific flag?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
In previous versions if you sort Report - you can't drag'n drop inside anymore.
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Tried latest sources. Took me 5 seconds to verify that "move down" does not work properly (which it did in XTP 13.0)... The implementation is completely wrong unless my code is wrong (please correct if that is the case):
// Move records down one step!
CXTPReportRecords* pMoveRecords = new CXTPReportRecords(TRUE);
if (_GetSelectedRows(pMoveRecords)) { int nextIndex = pMoveRecords->GetAt(0)->GetIndex() + 1; GetRecords()->Move(nextIndex, pMoveRecords); Populate();
_SelectRows(pMoveRecords); RedrawControl(); } CMDTARGET_RELEASE(pMoveRecords); For "move up" the index is calculated as follows:
int nextIndex = max(0, pMoveRecords->GetAt(0)->GetIndex() - 1);
Wrong results Four rows
A
B
C
D
Move down
* Select A,B (shift-click) and issue "move down". A and B are swapped: B,A,C,D. Expected result: C,A,B,D.
* Select A and issue "move down". Nothing happens. Expected result: B,A,C,D.
* Actually, I seldom get the desired result...
Move up
* Select A,B (shift-click) and issue "move up". A and B are swapped: B,A,C,D. Expected result: A,B,C,D.
* Select A,C (ctrl+click) and issue "move up": C,A,B,D. Expected result: A,C,B,D.
I think you don't account for the gap between selected records. |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Here's a test case for all relevant scenarios:
Data: A,B,C,D
Issue "Move up" after selection is made:
A selected -> A,B,C,D
B selected -> B,A,C,D
C,D selected -> A,C,D,B
A,B selected -> A,B,C,D
A,C selected -> A,C,B,D
A,B,C,D selected -> A,B,C,D
Issue "Move down" after selection is made:
D selected -> A,B,C,D
C selected -> A,B,D,C
A,B selected -> C,A,B,D
C,D selected -> A,B,C,D
B,D selected -> A,C,B,D
A,B,C,D selected -> A,B,C,D |
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Rows in report always sorted 0,1,.... but records behind rows not. So when we want to move selected records (which we get from selected rows) we need to find record index of insertion point - same as OnDrop function do.
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Correct. Drag'n'drop works like intended in 13.1. Basically, what I want to do is to drag all selected items +/- one step, programmatically. You don't have a function for this?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I think that you can follow logic of ReportControl::OnDrop function - current code you can find in given updated code link
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Is it possible to simulate a drag+drop? This way I don't have to copy all the code...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
What do you think yourself - which analog coming to your mind? Suppose you working with text - [Ctrl+X] - [Ctrl+V] - right? Try the same please
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Great idea! But where to paste it?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Unfortunately Control should use proper EditCopy, EditCut and EditPaste functionality. Till now and the same in ver 12.1 (https://forum.codejock.com/uploads/DemoVersion/ReportSampleStatic-12-1.rar) all paste going to the end.
[Ctrl+C and Ctrl+X - make proper selection, but Ctrl+V ignored position to paste - may be it will be possible to fix?].
Check void CXTPReportControl::Paste() function please
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Speaking of which, there are some typos in CXTPReportControl::OnDrop(). It says:
TRACE(_T("EXCEPTION: CXTPReportControl::Paste() - %s\n"), szErrText);
Looks like Paste() always adds records at the bottom. Like you said, it shouldn consider selection. I'd call this a bug :(
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Thanks - I changed it to TRACE(_T("EXCEPTION: CXTPReportControl::OnDrop() - %s\n"), szErrText); (same kind of typo - OnDrag - also fixed)
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Went back to clean XTP 13.1 and made some drag'n'drop-tests. It seems I can crash it quite easily...
A
B <-- drop point
C
D <--- anchor
E
F <--- shift key, end selection
G
After this operation, some of the records appear twice, and we later get a crash at CCmdTarget::InternalRelease().
I thought this bug only happened for my special move-call, but this is worse. When will 13.1.1 be released? I cannot release my software with this bug...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Sure you can't. Working on this. Hope Monday or Tuesday will finish. I also see some non-proper cases while in other case it working well.
|
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
I've had a ticket open with Mark about the drag & drop issues and he has been tracking down problems based on some test cases I submitted, alongwith his own discoveries (and I am sure based on the discussion here).
In all the back and forth, I've been wondering if it makes sense to revisit what the best general case pseudocode algorithm would be for handling internal movement of records in RC. I'm hoping I can get some feedback from MFC forum members (especially since you are more likely to understand the code and possible pitfalls). I'm sure if we all put our heads together, we can come up with a bulletproof algorithm for handling internal D&D. Here's my current idea:
Please shoot holes in it, expand it, improve it, question it, etc... until we can have something perfect. Let's start from the beginning and when we have something that appears that it should work, we can introduce optimizations (for example, short-circuit on all items selected, contiguous range dropped within itself, etc...). |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
All of these still exists with latest ReportPaneViewStatic:
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I am almost sure you did not use 14:51 timestamp version as I follows your steps without problems - please be sure we are running same verision
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
This is really tricky. Whoever gets this working 100% is no rookie :)
What am I doing wrong here? All drop operations are, in my eyes, erroneous. I get extra records when dropping etc...
Test case #1:
Using ctrl+click, select 1,2,4. Drop just above 3.
Expecting: 1,2,4,3
Result: 1,2,3,4
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Perhaps CJ should set up an IRC channel for instant communication?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Redownloaded to make sure I had latest version and retested. I can now confirm that all of items reported in my previous message are fixed. I also tested znakeeye's last case (Using ctrl+click, select 1,2,4. Drop just above 3.) and it seems to work for me with latest static sample. Are you still seeing that problem znakeeye?
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Redownloaded the static version above (10 seconds ago). Still same error:
Click 1
Ctrl+Click 2
Ctrl+Click 4
Mousedown on 4, drop between 2 and 3.
Result: 1,2,3,4 (selected: 1,2,3)
Expected: 1,2,4,3 (selected: 1,2,4)
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Crap! I just noticed the numbers don't change. Hang on...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Ok, works! :D
However, last time I merged "updated" sources with 13.1 my group rows got a grayed checkbox, which I have not seen before. What's that? Fixed?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Sorry - flag should be set FALSE by default but it was not. Fixed now. |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Mark, you might be happy to know that it doesn't even seem that Microsoft has gotten this right - unless someone can explain why the behaviour in Explorer is desirable:
Using znakeeye's test: Click 1
Ctrl+Click 2
Ctrl+Click 4
Mousedown on 4, drop between 2 and 3. I (and znakeeyes) would expect 1243. Indeed the Codejock RC now performs this way, which I think is great (and correct). Windows Explorer (Vista) results in 3124 though! Explorer behaviour makes no sense to me, so I think CJ wins in this case. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Thanks - I agree with you
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Cool! The Vista logic is indeed flawed. Somebody report? :D
Way to go doubson!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
So when can we expect 13.1.1? I sense a lot of bug fixes :)
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Official 13.2 (or 14.0 or 13.1.1 - I don't know exactly - think 14 is better than 13) should be in September (when Chart be ready and pass beta-testing) but you can use current updated source yet
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Go for 13.37!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Anyway, using your new code, how would you accomplish this drag-operation programmatically? Like my first post, using some Move() API?
As soon as I get this working, I'm happy!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Be more precise please - you want to make manual selection and after call function "Move this selection into given position" or you want function "Move Set(i1, ... iK) into given postition" (no manual selection - only set of indexes passed)?
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Good sample:
1,2,3,4 --> Select 1,2,4. Now you could drag'n'drop these records to produce 1,2,4,3. I want to perform this "Move up ONE step" (or down) without a drag'n'drop!
So yes, "Move selection into given position" would be great (if you tell me how to get that position :P).
Thanks for your time.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I tried such app code - it works -
void CReportPaneViewView::OnSmth() { CXTPReportSelectedRows* pSel = GetReportCtrl().GetSelectedRows();
pSel->Clear(); pSel->Add(GetReportCtrl().GetRows()->GetAt(3)); pSel->Add(GetReportCtrl().GetRows()->GetAt(7)); pSel->Add(GetReportCtrl().GetRows()->GetAt(5)); GetReportCtrl().RedrawControl(); CXTPReportRecords* pDropRecords = new CXTPReportRecords(TRUE); if (GetReportCtrl().GetSelectedRows()) { for (int i = 0; i < GetReportCtrl().GetSelectedRows()->GetCount(); i++) {CXTPReportRow* pRow = GetReportCtrl().GetSelectedRows()->GetAt(i); if (pRow) pDropRecords->Add(pRow->GetRecord()); }GetReportCtrl().GetRecords()->Move(9, pDropRecords); GetReportCtrl().Populate(); GetReportCtrl().GetSelectedRows()->Clear(); int nRecordsCount = pDropRecords->GetCount(); for (int nNewRecNr = 0; nNewRecNr < nRecordsCount; nNewRecNr++) {CXTPReportRecord* pRec = pDropRecords->GetAt(nNewRecNr); CXTPReportRow* pRow = GetReportCtrl().GetRows()->Find(pRec); if (pRow) {GetReportCtrl().GetSelectedRows()->Add(pRow); if (nNewRecNr == nRecordsCount - 1)GetReportCtrl().SetFocusedRow(pRow, TRUE); } } GetReportCtrl().RedrawControl(); } CMDTARGET_RELEASE(pDropRecords); } |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Nice. Will try immediately (updated with your latest code). However...
When dragging from control A (using custom clip-format) and dropping inside control B, nothing happens (worked before updating with your sources).
m_nDropPos == -1 |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
XTPReportControl.cpp(4666):
CXTPReportRow * pRow = HitTest(point); // You're assuming there will always be a row inside the control! My control is empty (same condition if dropping at the bottom)...if (pRow && pRow->GetRecord()) |
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
May be because of your special clip format? I just drag from modified app with flag you propose in other post (xtpReportAllowDragCopy) into static non-modifed app (with flags - xtpReportAllowDrag | xtpReportAllowDrop) and it works
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
And regarding this checkbox bug:
XTPReportPaintManager.cpp(798):
else if (bY && bN)
DrawGlyph(pDC, rcIcon, 5); //MiddleState Checked
I did not set this. Why is icon #5 painted?
Maybe you should change m_bUseGroupRowSelectionState to default to FALSE? |
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
And Get/Set functions for m_bUseGroupRowSelectionState... :(
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
about empty control - this is today change here (OnDrop) function
if (pRow){ }
else { return FALSE; } THIS IS WRONG!
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Right - it should be m_bUseGroupRowSelectionState = = FALSE; (I was sure it this!!!) but as you see - in some moment it set to TRUE;
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
There's definitely a bug here...
m_paneSource.EnableDragDrop(_T("MyRecords"), xtpReportAllowDragCopy);
m_paneTarget.EnableDragDrop(_T("MyRecords"), xtpReportAllowDrop | xtpReportAllowDragMove);
1,2,3,4
The drop of record 2 fails, and after that, when I select records 1-4 (shift-click), record 2 is NOT selected!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Let me know when sources updated :)
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Ready - now you can drop in empty control and also have FALSE for checkbox as default
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
New drop-bug:
Marker (red) is drawn above the header row when dropping in empty control!!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
As YOU propose - I made change in OnDragOver: if (pRow)... else m_nDropPos = 0;
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I can modify draw red marker code to cover this case void CXTPReportControl::DrawDropMarker(CDC* pDC){ CRect rc(m_rcReportArea.left, m_nDropPos, m_rcReportArea.right, m_nDropPos + 1); .................................... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Change on: void CXTPReportControl::DrawDropMarker(CDC* pDC) { if (m_nDropPos == 0) m_nDropPos = m_rcHeaderArea.Height(); ......
You can get fresh upgraded code |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I had a feeling...
First drop: 5 rows.
Second drop at top (hovering the header).
Last row is inserted at the bottom...
Bug: You allow dropping at the header.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I tried your case with empty report and no header or footer rows - it works as expected - do you have another setup?
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Get Updated source please - I covered this drop marker line case
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Better, but still buggy. Marker is correct, but the +-sign is indicates that a header-drop is a valid operation. This is wrong. When dropping at the header, the first row should be the drop point. Just like in Vista (top item must be a folder) - if you drop a file at the header, the file is moved into the folder!
So, just as it is now, do not draw the marker, but when dropping at the header - make the drop at row 0!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Also, during testing I discovered this weird bug again:
When a drop did not succeed, the source row became unselectable!
Source control:
A,B,C,D,E,F,G,H,I,J
Drag'n'Drop E,F,G,H to Target control. Success!
Now select A..J - I is not selected!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Another question... On the previous page you did this:
GetReportCtrl().GetRecords()->Move(9, pDropRecords);
That was one of the questions I had: How do you calculate this new index? Let's say I have an offset value of +2, then what? Do I need to find the maximum index value of the selected records and add 2? Similarly, for a value of -2 I would have to find the minimum index value?
This seems to work:
if (pDropRecords->GetCount() > 0)
{ int nMoveIndex = 0; if (offset < 0) nMoveIndex = pDropRecords->GetAt(0)->GetIndex() + offset; else nMoveIndex = pDropRecords->GetAt(pDropRecords->GetCount() - 1)->GetIndex() + offset + 1; // Not sure why +1 is needed here... GetRecords()->Move(nMoveIndex, pDropRecords);
Populate();
} |
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Thanks for header-footer case - get fresh update and play now please. https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar My static app is multi-panes - so you can use menu-file-new - it will create and fill new control. You can use Ctrl+A - Ctrl+X (or menu Edit-Cut) to clean body for your drag and drop testing with empty report (from Pane to Pane or run second instance of same app)
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
for your nInsert (index) question - this is the way [or get row by ordinal number]
CXTPReportRow* pRow = HitTest(point); if (pRow) ... pTargetRecord = pRow->GetRecord();.... nInsert = pTargetRecord->GetIndex()
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Will try soon, thanks.
I can't use pSelectedRows->GetAt(0)->GetRecord()->GetIndex()? I don't have a point...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
[or get row by ordinal number]
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Ordinal number = ?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
WYSIWYG: row0, row1, ...
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Sure, but in my case I probably have to get that index from the selected rows, right? |
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Why selected? Selected - source, Insert - destination. Choose needed row
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
On drop, yes. But when moving programmatically I have to _calculate_ the destination:
int destinationIndex = pSelectedRows->GetAt(0)->GetRecord()->GetIndex() + someOffset; // someOffset = -1 --> up ONE step.
Correct?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Works better, but ugly bug remains:
Source control:
A,B,C,D,E,F,G,H,I,J
Drag'n'Drop E,F,G,H to Target control. Success!
Now select A..J in source control - I is NOT selected! 100% reproducible using my two report controls. Repopulating the source control removes this oddness... |
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Selection issue fixed. Found a new problem though:
Drag'n'drop is not possible below last row:
Target control:
A
B
... empty space
Dropping here is forbidden!
Like in Vista, I think dropping shall be allowed both at the header (which I've already pin-pointed) and below the last row. Marker must of course never be misplaced...
Thanks.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Hey, as it already happened you are running yesterday code..
Get fresh updates please -
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar But drop in header and footer is not allowed and you have now all needed visual clue (drop marker and cursor icon)
I consider header and footer rows as special ones.
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Yes, the behavior is consistent. That's good.
I can accept that dropping at the header is not allowed, but below the last row is indeed a very useful drop area. Just tried dropping items/folders below the last row in Outlook 2007 - and it works. There's really no point in letting this area be dead.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
No - I consider this is confused user.
"Just tried dropping items/folders below the last row in Outlook 2007" - this is the case you use control as independant container - user don't care about position to insert new content.
But we care...
Our approach not restricts user's action - just need to follow graphical clue - if icon allow - drop, if not - move mouse to better position.
|
|
ABrailsford
Newbie Joined: 13 November 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Using 13.1.0 and just discovered the duplication of entries and strange behaviour when hold down the Shift and Control keys in the Report Control.
Just downloaded 13.2.1 and now find that duplication does not occur but deletion is now taking place.
This can be demonstrated in the Samples\ReportControl\ReportDialog shipped with 13.2.1. If you change the line of code in ReportDilogDlg.cpp as shown below.
m_wndReportCtrl.EnableDragDrop(_T("ReportDialog"), xtpReportAllowDragMove | xtpReportAllowDrop);
Whenever you try and move either a single selection or multiple selection, the records just disappear from the ReportControl.
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Can't reproduce your case - please get current code - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar so we can be sure we running the same |
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
Bug in ReportControlMFCUpdated, CXTPReportRecord.cpp
Using the following if you are constructing new records with children this fails: CXTPReportRecords* CXTPReportRecord::GetChilds() { if (m_pChildren == NULL) m_pChildren = new CXTPReportRecords(this); BOOL bCase = GetRecords()->IsCaseSensitive(); m_pChildren->SetCaseSensitive(bCase); return m_pChildren; } Shouldn't it be this instead? Where caseSensitive is a property of the "record" and not the "record list" which may or may not exist? CXTPReportRecords* CXTPReportRecord::GetChilds() { if (m_pChildren == NULL) m_pChildren = new CXTPReportRecords(this); m_pChildren->SetCaseSensitive(IsCaseSensitive()); return m_pChildren; } |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Sure not - you code just wrong - BOOL CXTPReportRecords::IsCaseSensitive() - not a member of CXTPReportRecord !
If you concern in this line - GetRecords()->IsCaseSensitive();
we can change it in more safe way:
if (GetRecords())
{
BOOL bCase = GetRecords()->IsCaseSensitive();
m_pChildren->SetCaseSensitive(bCase); } |
|
ABrailsford
Newbie Joined: 13 November 2009 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
I have now tested with the ReportControlMFCUpdated.rar and the issue is no longer present.
When is a new formal revision of the toolkit likely to be available?
|
|
Post Reply | Page 12> |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |