Print Page | Close Window

Sorry, crucial bug found in 13.1

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=14552
Printed Date: 20 April 2024 at 8:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Sorry, crucial bug found in 13.1
Posted By: znakeeye
Subject: Sorry, crucial bug found in 13.1
Date 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/



Replies:
Posted By: adrien
Date Posted: 17 June 2009 at 6:08pm
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

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: znakeeye
Date Posted: 18 June 2009 at 2:28am

I can live with that. Rollback?



-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 20 June 2009 at 5:31am
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/


Posted By: jpbro
Date Posted: 20 June 2009 at 3:59pm
I submitted a support ticket for a similar problem in the ActiveX version:

http://forum.codejock.com/forum_posts.asp?TID=14556 - 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



Posted By: mdoubson
Date Posted: 22 June 2009 at 9:46pm
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)

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 24 June 2009 at 3:09am
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/


Posted By: mdoubson
Date Posted: 28 June 2009 at 11:07pm
You can get updated (selection, moving, some minor improvements) source here https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar  
and refresh your version 


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 29 June 2009 at 2:50am
Thanks. Will try this in 12h :P

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 30 June 2009 at 7:38pm
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar -
Most recent source updates here -
 
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar


-------------
Mark Doubson, Ph.D.


Posted By: zaksoft
Date Posted: 01 July 2009 at 12:59am
New sources are dated 29 and 30 ( of july ) ....

-------------
VS2008 SP1 - VS2010 SP1 - VS2012 - MFC MBCS Statically linked
XTP 15.3.1 Static Link
---------------------------------------------------------
Davide Zaccanti - ZakSoft - www.zaksoft.com


Posted By: mdoubson
Date Posted: 01 July 2009 at 4:56am
Result of testing evaluation expiration same time. Use touch and change to current. It should not prevent you to build updated dll and app 

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 15 July 2009 at 10:28pm

Fresh demo with persist selection including child selection here - https://forum.codejock.com/uploads/DemoVersion/ReportSampleStaticProto.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSampleStaticProto.rar



-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 17 July 2009 at 7:16pm
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/


Posted By: mdoubson
Date Posted: 17 July 2009 at 11:02pm
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 - 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 - 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


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 18 July 2009 at 8:51am
Bug? WYSIWYG print mode. When double-clicking items they react... e.g. bold becomes normal.

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 18 July 2009 at 12:42pm
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();

}}}



-------------
Mark Doubson, Ph.D.


Posted By: Erin
Date Posted: 23 July 2009 at 3:02am
hi~~

I've updated version 13.1 with this https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - source updated files on June/2009

There's a bug about http://forum.codejock.com/forum_posts.asp?TID=13113 - 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!!


Posted By: mdoubson
Date Posted: 23 July 2009 at 12:04pm
Get fresh update and try again please - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
This is working progress archive and the viersion you referenced could be some intermmidiate.

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 25 July 2009 at 2:40am
Will try it next week at the playa :P.

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 04 August 2009 at 4:39pm
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/


Posted By: znakeeye
Date Posted: 04 August 2009 at 4:46pm
Bug #2:
There is a small checkbox on my group row. Have never seen it before...


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 04 August 2009 at 4:52pm
Make a simple research to understand it's purpose

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 04 August 2009 at 5:00pm
You asked about test-cases and Fixed conclusion. I don't have testers  to conform it so I can only confirmed that
 
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStaticJuly31.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStaticJuly31.rar
 
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/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
 
https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar - 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 - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 05 August 2009 at 3:26am
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/


Posted By: mdoubson
Date Posted: 05 August 2009 at 11:56am
In previous versions if you sort Report - you can't drag'n drop inside anymore.

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 05 August 2009 at 6:47pm
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/


Posted By: znakeeye
Date Posted: 05 August 2009 at 6:54pm
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/


Posted By: mdoubson
Date Posted: 06 August 2009 at 8:35am
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.

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 06 August 2009 at 8:51am

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/


Posted By: mdoubson
Date Posted: 06 August 2009 at 8:55am
I think that you can follow logic of ReportControl::OnDrop function - current code you can find in given updated code link
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 06 August 2009 at 3:28pm
Is it possible to simulate a drag+drop? This way I don't have to copy all the code...

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 06 August 2009 at 4:31pm
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

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 06 August 2009 at 4:41pm
Great idea! But where to paste it?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 06 August 2009 at 4:48pm
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 - 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


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 1:45am
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 1:10pm
Thanks - I changed it to TRACE(_T("EXCEPTION: CXTPReportControl::OnDrop() - %s\n"), szErrText);  (same kind of typo - OnDrag - also fixed)
 
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 2:08pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 2:25pm
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.

-------------
Mark Doubson, Ph.D.


Posted By: jpbro
Date Posted: 07 August 2009 at 2:51pm
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:


1) Get copy of selected records
2) Store focused row
3) Sort selected records same as current RC sort order (or translate selected array to order of sorted array).
I think this should be done even if report is not sorted in order to guarantee that we are getting the list of rows in the same order they appear on-screen
(even when rows were selected in random order by the user)
4) Get insertion point row (row BEFORE we have dropped selection, or -1 if adding to bottom of list)
 // NOTE: Not sure of best way to handle move to bottom of list - Any ideas?
5) If sorted then ReleaseSort
6) Loop through sorted selected records
1) If selected record row index != insert point row // needs to move
1) Move selected record to insert point row
2) If selected record row index > insert point row
1) insert point row ++ //because insertion row pushed down
7) RefreshIndexes
8) Restore selected rows (you could loop i=insertpoint-1; i>=insertpoint-selectedrowcount; i--)
9) Restore focused row


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



Posted By: mdoubson
Date Posted: 07 August 2009 at 2:56pm
Please try again after modifications -
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar

-------------
Mark Doubson, Ph.D.


Posted By: jpbro
Date Posted: 07 August 2009 at 3:00pm
All of these still exists with latest ReportPaneViewStatic:


Click H
Shift+Click G
Drag G to between H and header
G & H swap positions (expected nothing to happen)

Click H
Shift+Click G
Drag G to between G and F
H is destroyed (expected nothing to happen)

Click H
Ctrl+Click F (to get non-contiguous selection)
Drag F to between G & F
F is duplicated, closing sample crashes (expected GHFE...)

Click H
Shift+Click F (to get 3 contiguous row selected)
Drag F between H and header
F is destroyed, G & H swap positions (expected nothing to happen)

Click H
Shift+Click F
Drag F between G & F
H is destroyed (expected nothing to happen)



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: mdoubson
Date Posted: 07 August 2009 at 3:07pm
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

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 3:11pm
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/


Posted By: znakeeye
Date Posted: 07 August 2009 at 3:12pm
Perhaps CJ should set up an IRC channel for instant communication?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: jpbro
Date Posted: 07 August 2009 at 3:20pm
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



Posted By: znakeeye
Date Posted: 07 August 2009 at 3:30pm
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/


Posted By: znakeeye
Date Posted: 07 August 2009 at 3:30pm
Crap! I just noticed the numbers don't change. Hang on...

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 07 August 2009 at 3:32pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 3:44pm

Sorry - flag should be set FALSE by default but it was not. Fixed now.



-------------
Mark Doubson, Ph.D.


Posted By: jpbro
Date Posted: 07 August 2009 at 4:05pm
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



Posted By: mdoubson
Date Posted: 07 August 2009 at 4:06pm
Thanks - I agree with you

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 4:21pm
Cool! The Vista logic is indeed flawed. Somebody report? :D
 
Way to go doubson!


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 07 August 2009 at 4:23pm
So when can we expect 13.1.1? I sense a lot of bug fixes :)

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 07 August 2009 at 4:28pm

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


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 4:31pm
Go for 13.37!

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date Posted: 07 August 2009 at 4:35pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 4:44pm
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)?

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 5:07pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 5:46pm
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);

}



-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 5:49pm
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/


Posted By: znakeeye
Date Posted: 07 August 2009 at 5:52pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 5:57pm
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

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 5:58pm
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/


Posted By: znakeeye
Date Posted: 07 August 2009 at 6:01pm
And Get/Set functions for m_bUseGroupRowSelectionState... :(

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:03pm
about empty control - this is today change here (OnDrop) function

if (pRow){ }

else { return FALSE; } THIS IS WRONG!



-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:05pm
Right - it should be m_bUseGroupRowSelectionState = = FALSE; (I was sure it this!!!) but as you see - in some moment it set to TRUE;

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 6:06pm
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/


Posted By: znakeeye
Date Posted: 07 August 2009 at 6:06pm
Let me know when sources updated :)

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:15pm
Ready - now you can drop in empty control and also have FALSE for checkbox as default

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 6:34pm
New drop-bug:
 
Marker (red) is drawn above the header row when dropping in empty control!!


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:41pm
As YOU propose - I made change in OnDragOver:  if (pRow)... else m_nDropPos = 0;


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:42pm

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);

....................................


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 07 August 2009 at 6:52pm
Change on:  void CXTPReportControl::DrawDropMarker(CDC* pDC) { if (m_nDropPos == 0) m_nDropPos = m_rcHeaderArea.Height(); ......
 
You can get fresh upgraded code


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 07 August 2009 at 8:18pm
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/


Posted By: mdoubson
Date Posted: 07 August 2009 at 8:22pm
I tried your case with empty report and no header or footer rows - it works as expected - do you have another setup?

-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 07 August 2009 at 8:35pm
Get Updated source please - I covered this drop marker line case

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 08 August 2009 at 5:29am

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/


Posted By: znakeeye
Date Posted: 08 August 2009 at 5:31am
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/


Posted By: znakeeye
Date Posted: 08 August 2009 at 5:46am
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/


Posted By: mdoubson
Date Posted: 08 August 2009 at 9:33am

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/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar - https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.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)


-------------
Mark Doubson, Ph.D.


Posted By: mdoubson
Date Posted: 08 August 2009 at 9:43am
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()


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 08 August 2009 at 11:55am
Will try soon, thanks.
 
I can't use pSelectedRows->GetAt(0)->GetRecord()->GetIndex()? I don't have a point...


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 08 August 2009 at 11:56am
 [or get row by ordinal number]

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 08 August 2009 at 12:03pm
Ordinal number = ?

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 08 August 2009 at 12:06pm
WYSIWYG: row0, row1, ...

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 08 August 2009 at 12:34pm

Sure, but in my case I probably have to get that index from the selected rows, right?



-------------
PokerMemento - http://www.pokermemento.com/


Posted By: mdoubson
Date Posted: 08 August 2009 at 12:39pm
Why selected? Selected - source, Insert - destination. Choose needed row

-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 08 August 2009 at 12:44pm
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/


Posted By: znakeeye
Date Posted: 08 August 2009 at 1:44pm
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/


Posted By: mdoubson
Date Posted: 10 August 2009 at 1:00pm
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar -
https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
Try again please


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 10 August 2009 at 5:52pm
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/


Posted By: mdoubson
Date Posted: 10 August 2009 at 5:55pm
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/ReportControlMFCUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlUpdated.rar
https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.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.


-------------
Mark Doubson, Ph.D.


Posted By: znakeeye
Date Posted: 11 August 2009 at 2:55am
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/


Posted By: mdoubson
Date Posted: 11 August 2009 at 12:44pm
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.


-------------
Mark Doubson, Ph.D.


Posted By: ABrailsford
Date Posted: 13 November 2009 at 10:22am
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.


Posted By: mdoubson
Date Posted: 13 November 2009 at 12:59pm

Can't reproduce your case - please get current code - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/ReportControlMFCUpdated.rar

so we can be sure we running the same

-------------
Mark Doubson, Ph.D.


Posted By: Algae
Date Posted: 22 November 2009 at 9:45pm
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;
}


Posted By: mdoubson
Date Posted: 22 November 2009 at 10:22pm
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);
}
 


-------------
Mark Doubson, Ph.D.


Posted By: ABrailsford
Date Posted: 24 November 2009 at 10:55am
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?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net