|
The demo works fine when compiled with VS 2003 but not when compiled with VS 2010. The RVN* NOTIFY messages are not passed to the view for some reason. Microsoft must have changed something with the ON_NOTIFY, haven't been able to figure it out yet.
|
|
|
|
|
just given m_wndMyReportCtrl control a non-zero ID,
0, ReportCtrl.h
#define ID_REPORTCTRL 1256
1,ReportDemoView.cpp
if (m_wndMyReportCtrl.Create(dwStyle, rect, this, ID_REPORTCTRL) == NULL)
AfxThrowMemoryException();
2,ReportDemoView.cpp
ON_NOTIFY(RVN_ITEMDRAWPREVIEW, ID_REPORTCTRL, OnRvnItemDrawPreview)
ON_NOTIFY(RVN_ITEMCLICK, ID_REPORTCTRL, OnRvnItemClick)
ON_NOTIFY(RVN_ITEMDBCLICK, ID_REPORTCTRL, OnRvnItemDbClick)
ON_NOTIFY(RVN_BEGINITEMEDIT, ID_REPORTCTRL, OnRvnBeginItemEdit)
ON_NOTIFY(RVN_BUTTONCLICK, ID_REPORTCTRL, OnRvnButtonClick)
ON_NOTIFY(RVN_KEYDOWN, ID_REPORTCTRL, OnRvnKeyDown)
ON_NOTIFY(RVN_HEADERRCLICK, ID_REPORTCTRL, OnRvnHeaderRClick)
ON_NOTIFY(RVN_CATEGORYRCLICK, ID_REPORTCTRL, OnRvnCategoryRClick)
ON_NOTIFY(RVN_NEWWIDTH, ID_REPORTCTRL, OnRvnNewWidth)
3,ReportCtrl.cpp
as last....
|
|
|
|
|
Good job,
Have you step by step indications to add a CReportCtrl or a CReportView into an existing application ?
Thanks
modified on Saturday, July 17, 2010 12:04 PM
|
|
|
|
|
Hi,
I do not know the name of the english setting: Go to desktop, click right mouse button / settings / effects / deactivate the option which moves the whole window.
If you are resizing a window, only the small borders are resized. You have to release the mouse button to have the window be redrawn.
(Perhaps on a WTS you have the same settings)
With that settings, open the demo and try to resize columns. That does not work. You can see the small vertical bar which indicates the current mouse position. If you release the button, nothing happens.
I haven't researched the reason but found the lines of codes which introduced that bug.
<br />
void CFlatHeaderCtrl::OnLButtonUp(UINT nFlags, CPoint point)<br />
{<br />
...<br />
... <br />
m_LButtonUp = TRUE; <br />
CHeaderCtrl::OnLButtonUp(nFlags, ptClickPoint);<br />
m_LButtonUp = FALSE; <br />
m_bResizing = FALSE;<br />
m_bFixWidth = FALSE;<br />
}
After removing the bold lines of code, the resizing of columns does work with these settings.
Perhaps that helps
Ciao
Siegmund
|
|
|
|
|
Neither can I. I cannot think of any reason why this should be so.
Sorry and good luck.
Andre
PS: If you figure it out, please post the reason or solution, so others could use it. I would be very curious to know.
|
|
|
|
|
I have a question about your Report Control on Codeproject.
http://www.codeproject.com/miscctrl/ReportProject.asp
Here is an example.
If I have 10 items displayed and I called GetItemText(9,0) it returns the
proper text for the last row first column.
But if I sort that column by clicking the header. Then call
GetItemText(9,0) it still returns the same value as before the row was
sorted, it does not return the value that is currently in the last row.
|
|
|
|
|
The code should be GetItemText(GetItemForRow(9))
This was tested by the person who posted the question and found to work
Andre
|
|
|
|
|
Hello, I try to use this class as a static library but there is a lot of unsolved warnings. Can you help me what I do bad? Because there is no error in your samle code.
Thanks. xSoptik
------ Build started: Project: clReportCtrl, Configuration: Debug Win32 ------
Deleting intermediate files and output files for project 'clReportCtrl', configuration 'Debug|Win32'.
Compiling...
stdafx.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling...
ReportOptionsCtrl.cpp
d:\DevCom\Projects\lib\clReportCtrl\ReportOptionsCtrl.cpp(433) : warning C4311: 'type cast' : pointer truncation from 'CRuntimeClass *' to 'DWORD'
d:\DevCom\Projects\lib\clReportCtrl\ReportOptionsCtrl.cpp(451) : warning C4311: 'type cast' : pointer truncation from 'CRuntimeClass *' to 'DWORD'
d:\DevCom\Projects\lib\clReportCtrl\ReportOptionsCtrl.cpp(500) : warning C4312: 'type cast' : conversion from 'DWORD' to 'CRuntimeClass *' of greater size
d:\DevCom\Projects\lib\clReportCtrl\ReportOptionsCtrl.cpp(754) : warning C4244: '=' : conversion from 'LRESULT' to 'BOOL', possible loss of data
ReportCtrl.cpp
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(446) : warning C4267: '=' : conversion from 'size_t' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(902) : warning C4244: 'return' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1060) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1090) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1111) : warning C4244: 'return' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1116) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1367) : warning C4267: 'return' : conversion from 'size_t' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1434) : warning C4244: 'return' : conversion from 'LPARAM' to 'DWORD', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1537) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1602) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1612) : warning C4244: '=' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1723) : warning C4244: 'return' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1844) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1882) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(1898) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2061) : warning C4312: 'type cast' : conversion from 'UINT' to 'LPCTSTR' of greater size
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2243) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2244) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2351) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2373) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2388) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2407) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2450) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2465) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2484) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2490) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2494) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2597) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2642) : warning C4244: '=' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2862) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2950) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(2977) : warning C4244: '=' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3101) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3267) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3432) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3566) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3644) : warning C4244: '=' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3700) : warning C4244: 'return' : conversion from 'LRESULT' to 'BOOL', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3866) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3900) : warning C4311: 'type cast' : pointer truncation from 'CReportCtrl::LPTREEITEM' to 'ULONG'
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3986) : warning C4244: 'argument' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(3998) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4048) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4070) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4139) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4249) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4276) : warning C4244: 'return' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4291) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4334) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(4942) : warning C4244: '=' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(5008) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(5246) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(5298) : warning C4244: '=' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(6749) : warning C4244: '=' : conversion from '__w64 int' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7097) : warning C4244: 'argument' : conversion from 'LPARAM' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7125) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7282) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7295) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7334) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7432) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7478) : warning C4244: 'argument' : conversion from 'ULONG_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7537) : warning C4244: '=' : conversion from 'DWORD_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7580) : warning C4244: '=' : conversion from 'LRESULT' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7842) : warning C4244: '=' : conversion from 'WPARAM' to 'UINT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(7948) : warning C4244: '=' : conversion from 'WPARAM' to 'UINT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8047) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8334) : warning C4244: 'initializing' : conversion from 'LRESULT' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8532) : warning C4244: 'initializing' : conversion from 'ULONG_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8550) : warning C4244: 'initializing' : conversion from 'ULONG_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8610) : warning C4312: 'type cast' : conversion from 'INT' to 'LPCTSTR' of greater size
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(8650) : warning C4244: 'argument' : conversion from 'WPARAM' to 'INT', possible loss of data
FlatHeaderCtrl.cpp
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1118) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1124) : warning C4244: '=' : conversion from 'LRESULT' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1212) : warning C4244: 'initializing' : conversion from 'LRESULT' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1378) : warning C4244: '=' : conversion from 'LRESULT' to 'INT', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1394) : warning C4244: 'argument' : conversion from '__w64 int' to 'int', possible loss of data
d:\DevCom\Projects\lib\clReportCtrl\FlatHeaderCtrl.cpp(1706) : warning C4244: 'initializing' : conversion from 'LRESULT' to 'INT', possible loss of data
Generating Code...
Creating library...
Build log was saved at "file://d:\DevCom\Projects\lib\clReportCtrl\Debug\BuildLog.htm"
clReportCtrl - 0 error(s), 81 warning(s)
---------------------- Done ----------------------
Build: 1 succeeded, 0 failed, 0 skipped
|
|
|
|
|
NOt too sure it is related to static library.
It seems to me that the errors are caused by conversion from 64 bits to 32 bits
example:
d:\DevCom\Projects\lib\clReportCtrl\ReportCtrl.cpp(6749) : warning C4244: '=' : conversion from '__w64 int' to 'INT', possible loss of data
it is trying to store a 64 bits integer into an INT so the INT is probably 32 bits.
May be the best thing to do is to change every INT into LONG
Maybe just do it where you have warning...
Good luck
Andre
|
|
|
|
|
I gave it a try - it appears to have problems:
File/test/testoptions
Double -click(why not single click) on the edit control.Click out
You will get an exception:
HEAP[ReportDemo.exe]: HEAP: Free Heap block a10918 modified at a10960 after it was freed
The same goes for the combo.
Too Bad.It has a great design.
|
|
|
|
|
Thanks for trying this new version. I will look at this problem.
I have a few things to work at first so it will be a while. I have never used this type of control in my code and I do not expect that many use it.
There is always been a very obscure bug in this code. I made some change when I first tested it that seem to fix it but I was not very happy with the changes. I hope that this bug may better reveal the problem.
I have a couple of questions. Which version of dev-studio are you using? I do not get nearly as nice a message with the exception. Are you using debug heap?
Andre
|
|
|
|
|
Just submitted version 3.0.2 which fixes this bug.
I tried to fix it when I got the code originally to no avail needed some incentive.
|
|
|
|
|
in file: ... ReportProject_src\Report\ReportDemo\dialogs.h line 12
#include "c:\programs\report\reportctrl.h" replace with
#include "../reportctrl.h"
Thanks for the article.
|
|
|
|
|
Thanks for fixing this I will fix my source.
|
|
|
|
|
Thanks for your excellent work.
---------------------------
Angus He
|
|
|
|
|
Great report control (and yes, I really remember Maarten job, and I still love this control), but there is the needing to make some checks to compile in UNICODE.
The simplest are some string constants "" that must be move into _T("")
some function replacements, from -> to:
atoi -> _ttoi
strlen -> _tcslen
strcpy -> _tcscpy
(the _tcsXXX are described in the tchar.h file)
some declarations written as char must be changed in TCHAR (in the demo).
Some more attention to these points:
(ReportCtrl.cpp, line 8234)
g_lpfnUpdateLayeredWindow = (lpfnUpdateLayeredWindow) GetProcAddress(hUser32, "UpdateLayeredWindow");
g_lpfnSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes) GetProcAddress(hUser32,
"SetLayeredWindowAttributes");
(FlatHeaderCtrl.cpp, line 1305)
#ifndef _UNICODE
USES_CONVERSION;
wcscpy((WCHAR *) pTTT->lpszText, A2W((LPCTSTR) m_arrayHdrItemEx[m_iHotIndex].strToolTip));
#else
wcscpy((WCHAR *) pTTT->lpszText, (LPCTSTR) m_arrayHdrItemEx[m_iHotIndex].strToolTip);
#endif
pTTT->lpszText = pTTT->szText;
return TRUE;
|
|
|
|
|
I have never worked with Unicode so maybe someone else could make the changes an re-issued the code
|
|
|
|
|
Just happened to see your adaptation of my code. You added the features I should have added, so thanks for doing so.
Just a little nag; it is actually more than compatible with my code; it is largely my code, so it would be better to rephrase it in something like; This code was based on Maarten Hoeben's ReportCtrl. Maybe that was lost in translation...
Regards
Maarten Hoeben
|
|
|
|
|
I have submitted a change which should reflect your comment. Thank you for your positive comments.
|
|
|
|
|