|
|
VT_DECIMAL conversion in CheckVariant returns improper value when the decimal number has more than 9 digits : 'SELECT 0.1234567891' returns 0.875539 !
You should replace
dval = vtFld.decVal.Lo32;
dval *= (vtFld.decVal.sign == 128)? -1 : 1;
dval /= pow(10, vtFld.decVal.scale);
By: VarR8FromDec(&vtFld.decVal, &dval);
Franck
|
|
|
|
|
Since the author didn't provide one, does anyone have a working VC6 sample project that he/she would be willing to share with others? Thanks for listening.
|
|
|
|
|
m_Grid.InsertRow("");
m_Grid.Refresh();
m_Grid.AddNewRecord();//??
|
|
|
|
|
Hi. Thanks for your source.(I'm corean, Writing in English is hard for me..)
I'm using this class.
I have problem using this class (CDbMFCGrid)
(I use Visual C++ Dot.net 2003)
My program has 6 clolumns and 100 rows..
but current my mdb file has 2 records,
When I click cell the debuger show this massage.. "Microsoft C++ exception: _com_error @ 0x0012fc24"
What this message..?
this is my source..
SetMouseMode(MOUSE_SELECT_ROW);
m_strDataSource = "Provider=Microsoft.Jet.OLEDB.4.0;"
"Data Source=Database.mdb";
m_strQuery = "select * from InfoTable";
Bind();
FillGrid();
SetColumnCount(11);
SetRowCount(100);
CFont* pFont = GetFont();
LOGFONT lf;
pFont->GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
int rowcount = GetRowCount();
for(int i = 0 ; i < rowcount ; i++)
{
SetRowHeight(i,DEFAULTHEIGHT);
}
int columncount = GetColumnCount();
for(int i = 0 ; i < columncount ; i++)
{
if(i==0)
{
SetColumnWidth(i,35);
}
else
{
SetColumnWidth(i,80);
}
SetItemBkColour(0,i,RGB(212,208,200));
SetItemFont(0,i,&lf);
SetItemState(0,i,GVIS_READONLY | GVIS_FIXED);
}
I need help~~
|
|
|
|
|
--------------------Configuration: Sports - Win32 Release--------------------
Compiling resources...
Compiling...
DbMFCGrid.cpp
GridCellNumeric.cpp
SportsView.cpp
Generating Code...
Linking...
DbMFCGrid.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CGridCtrl::ValidateEdit(int,int,char const *)" (?ValidateEdit@CGridCtrl@@MAEHHHPBD@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall CGridCtrl::PrintFixedRowCells(int,int,int &,class CRect &,class CDC *,int &)" (?PrintFixedRowCells@CGridCtrl@@MAEXHHAAHAAVCRect@@PAVCDC@@0@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCtrl::OnDrop(class COleDataObject *,unsigned long,class CPoint)" (?OnDrop@CGridCtrl@@UAEHPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCtrl::OnDragLeave(void)" (?OnDragLeave@CGridCtrl@@UAEXXZ)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCtrl::OnDragOver(class COleDataObject *,unsigned long,class CPoint)" (?OnDragOver@CGridCtrl@@UAEKPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCtrl::OnDragEnter(class COleDataObject *,unsigned long,class CPoint)" (?OnDragEnter@CGridCtrl@@UAEKPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCtrl::OnBeginDrag(void)" (?OnBeginDrag@CGridCtrl@@UAEXXZ)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCtrl::PasteTextToGrid(class CCellID,class COleDataObject *,int)" (?PasteTextToGrid@CGridCtrl@@UAEHVCCellID@@PAVCOleDataObject@@H@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::SetListMode(int)" (?SetListMode@CGridCtrl@@QAEXH@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: int __thiscall CGridCtrl::SortTextItems(int,int,long)" (?SortTextItems@CGridCtrl@@QAEHHHJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: static int __stdcall CGridCtrl::pfnCellTextCompare(long,long,long)" (?pfnCellTextCompare@CGridCtrl@@SGHJJJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: int __thiscall CGridCtrl::SortItems(int,int,long)" (?SortItems@CGridCtrl@@QAEHHHJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::SetCompareFunction(int (__stdcall*)(long,long,long))" (?SetCompareFunction@CGridCtrl@@QAEXP6GHJJJ@Z@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: static int __stdcall CGridCtrl::pfnCellNumericCompare(long,long,long)" (?pfnCellNumericCompare@CGridCtrl@@SGHJJJ@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCellBase::ValidateEdit(char const *)" (?ValidateEdit@CGridCellBase@@UAEHPBD@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CSize __thiscall CGridCellBase::GetTextExtent(char const *,class CDC *)" (?GetTextExtent@CGridCellBase@@UAE?AVCSize@@PBDPAVCDC@@@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCellBase::operator=(class CGridCellBase const &)" (??4CGridCellBase@@UAEXABV0@@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CGridCellBase * __thiscall CGridCellBase::GetDefaultCell(void)const " (?GetDefaultCell@CGridCellBase@@UBEPAV1@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall CGridCell::GetMargin(void)const " (?GetMargin@CGridCell@@UBEIXZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CFont * __thiscall CGridCell::GetFontObject(void)const " (?GetFontObject@CGridCell@@UBEPAVCFont@@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual struct tagLOGFONTA * __thiscall CGridCell::GetFont(void)const " (?GetFont@CGridCell@@UBEPAUtagLOGFONTA@@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCell::GetFormat(void)const " (?GetFormat@CGridCell@@UBEKXZ)
SportsView.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::AutoSize(unsigned int)" (?AutoSize@CGridCtrl@@QAEXI@Z)
SportsView.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::ExpandColumnsToFit(int)" (?ExpandColumnsToFit@CGridCtrl@@QAEXH@Z)
SportsView.obj : error LNK2001: unresolved external symbol "protected: long __thiscall CGridCtrl::SendDisplayRequestToParent(struct tagGV_DISPINFO *)const " (?SendDisplayRequestToParent@CGridCtrl@@IBEJPAUtagGV_DISPINFO@@@Z)
Release/Sports.exe : fatal error LNK1120: 25 unresolved externals
Error executing link.exe.
Sports.exe - 26 error(s), 0 warning(s)
It works on vc6. Any help appreciated.
|
|
|
|
|
You havee to add include files for CGridCtrl . See the message below this thread.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Thanks.
The errors also.
//In my view that uses the grid. sportsview.h
#include ".\ado\ado.h"
#include ".\gridctrl_src\dbmfcgrid.h" //include the header for the grid
//In the dbmfcgrid.h
#include "GridCtrl.h"
//In the GridCtrl.h
#include "CellRange.h"
#include "GridCell.h"
#include <afxtempl.h>
//In the gridcellnumeric.h
#include "GridCell.h"
All the files for the grid in the folder .\gridctrl_src.
The list here:
cellrange.h
dbmfcgrid.h dbmfcgrid.cpp
gridcell.h gridcell.cpp
gridcellbase.h gridcellbase.cpp
gridcellnumeric.h gridcellnumeric.cpp
gridctrl.h gridctrl.cpp
griddroptarget.h griddroptarget.cpp
inplaceedit.h inplaceedit.cpp
memdc.h
titletip.h titletip.cpp
I did my best.Is there a simple example for me?
My email:1noloo@163.com
Thanks very much.
|
|
|
|
|
Excuse me.
//In the gridctrl.h
#include "CellRange.h"
#include "GridCell.h"
#include <afxtempl.h>
|
|
|
|
|
//In the gridctrl.h
#include "CellRange.h"
#include "GridCell.h"
#include "afxtempl.h"
//my god~
|
|
|
|
|
Sorry , Whats the error ?
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
--------------------Configuration: Sports - Win32 Release--------------------
Compiling resources...
Compiling...
DbMFCGrid.cpp
GridCellNumeric.cpp
SportsView.cpp
Generating Code...
Linking...
DbMFCGrid.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall CGridCtrl::ValidateEdit(int,int,char const *)" (?ValidateEdit@CGridCtrl@@MAEHHHPBD@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall CGridCtrl::PrintFixedRowCells(int,int,int &,class CRect &,class CDC *,int &)" (?PrintFixedRowCells@CGridCtrl@@MAEXHHAAHAAVCRect@@PAVCDC@@0@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCtrl::OnDrop(class COleDataObject *,unsigned long,class CPoint)" (?OnDrop@CGridCtrl@@UAEHPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCtrl::OnDragLeave(void)" (?OnDragLeave@CGridCtrl@@UAEXXZ)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCtrl::OnDragOver(class COleDataObject *,unsigned long,class CPoint)" (?OnDragOver@CGridCtrl@@UAEKPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCtrl::OnDragEnter(class COleDataObject *,unsigned long,class CPoint)" (?OnDragEnter@CGridCtrl@@UAEKPAVCOleDataObject@@KVCPoint@@@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCtrl::OnBeginDrag(void)" (?OnBeginDrag@CGridCtrl@@UAEXXZ)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCtrl::PasteTextToGrid(class CCellID,class COleDataObject *,int)" (?PasteTextToGrid@CGridCtrl@@UAEHVCCellID@@PAVCOleDataObject@@H@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::SetListMode(int)" (?SetListMode@CGridCtrl@@QAEXH@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: int __thiscall CGridCtrl::SortTextItems(int,int,long)" (?SortTextItems@CGridCtrl@@QAEHHHJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: static int __stdcall CGridCtrl::pfnCellTextCompare(long,long,long)" (?pfnCellTextCompare@CGridCtrl@@SGHJJJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: int __thiscall CGridCtrl::SortItems(int,int,long)" (?SortItems@CGridCtrl@@QAEHHHJ@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::SetCompareFunction(int (__stdcall*)(long,long,long))" (?SetCompareFunction@CGridCtrl@@QAEXP6GHJJJ@Z@Z)
DbMFCGrid.obj : error LNK2001: unresolved external symbol "public: static int __stdcall CGridCtrl::pfnCellNumericCompare(long,long,long)" (?pfnCellNumericCompare@CGridCtrl@@SGHJJJ@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CGridCellBase::ValidateEdit(char const *)" (?ValidateEdit@CGridCellBase@@UAEHPBD@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CSize __thiscall CGridCellBase::GetTextExtent(char const *,class CDC *)" (?GetTextExtent@CGridCellBase@@UAE?AVCSize@@PBDPAVCDC@@@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CGridCellBase::operator=(class CGridCellBase const &)" (??4CGridCellBase@@UAEXABV0@@Z)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CGridCellBase * __thiscall CGridCellBase::GetDefaultCell(void)const " (?GetDefaultCell@CGridCellBase@@UBEPAV1@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall CGridCell::GetMargin(void)const " (?GetMargin@CGridCell@@UBEIXZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual class CFont * __thiscall CGridCell::GetFontObject(void)const " (?GetFontObject@CGridCell@@UBEPAVCFont@@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual struct tagLOGFONTA * __thiscall CGridCell::GetFont(void)const " (?GetFont@CGridCell@@UBEPAUtagLOGFONTA@@XZ)
GridCellNumeric.obj : error LNK2001: unresolved external symbol "public: virtual unsigned long __thiscall CGridCell::GetFormat(void)const " (?GetFormat@CGridCell@@UBEKXZ)
SportsView.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::AutoSize(unsigned int)" (?AutoSize@CGridCtrl@@QAEXI@Z)
SportsView.obj : error LNK2001: unresolved external symbol "public: void __thiscall CGridCtrl::ExpandColumnsToFit(int)" (?ExpandColumnsToFit@CGridCtrl@@QAEXH@Z)
SportsView.obj : error LNK2001: unresolved external symbol "protected: long __thiscall CGridCtrl::SendDisplayRequestToParent(struct tagGV_DISPINFO *)const " (?SendDisplayRequestToParent@CGridCtrl@@IBEJPAUtagGV_DISPINFO@@@Z)
Release/Sports.exe : fatal error LNK1120: 25 unresolved externals
Error executing link.exe.
Sports.exe - 26 error(s), 0 warning(s)
You suggested that i must inclucde CGridCtrl's heads. And I did so,but the linker errors also.
Thanks.
|
|
|
|
|
when I am compiling my project,I received the message as below: "fatal error C1083: Cannot open include file: 'GridCellNumeric.h': No such file or directory
Error executing cl.exe."
I think that would be no the file "GridCellNumeric.h".
In the file "DbMFCGrid.cpp" there is a line "#include "GridCellNumeric.h" ". that is why I have the error.
Could you mail me the file "GridCellNumeric.h," and "GridCellNumeric.cpp".? Thanks .
My email is "Lin_jinlong@tom.com".
|
|
|
|
|
|
Hi,
does anybody of you have a link to an example application or maybe could send one to me via email (fpleyer76@gmx.de) with this DataGrid.
I tryed to include it to my CFORMVIEW Project, but get various compiling
errors. I work with VC7...
THX
Frank
|
|
|
|
|
Maybe you didn't add proper links,I wrote this project eith VC7.
Mazdak
|
|
|
|
|
Hello, Mazdak.
The original question still remains: Do you think you could please provide an example program? (It's always easier to play around with an author's code when it's within a working program, as opposed to just examining it in the abstract.) This is especially true when language difficulties make it a little tough to ask and answer questions - looking at code in the universal language of C++ within a running debug application works ~so~ much better - <g>.
Thank you very much for listening.
|
|
|
|
|
When left clicking (one click) on a cell belonging to the currently selected row, the cell does not get focus. (I thought the behavior was a random one, because if you move a little bit the mouse while the button is still down, you get focus...)
I tried this to correct: add an override to the OnLButtonDown member.
void CDbMFCGrid::OnLButtonDown(UINT nFlags, CPoint point)
{
GridCtrl::OnLButtonDown(nFlags, point);
SetFocusCell(m_LeftClickDownCell);
}
Comments welcome.
Andre Perroud
|
|
|
|
|
Thanks Andre.
Mazy
No sig. available now.
|
|
|
|
|
I also have this problem. Thank you a lot.
|
|
|
|
|
Congratulation, you did a good job, but I have a couple of notes for you
Compiling your code I got errors on:
- the call to the GetBuffer() method: missing parameter (first one at line 260)
- the cast to PositionEnum_Param: should be PositionEnum (first one at line 279)
Ciao, Marco.
|
|
|
|
|
I don't know why do get these error for these line.These parts do not written by me.I think it is better to send a messasge to the main article for MFC grid.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Mazdak wrote:
I don't know why do get these error for these line.These parts do not written by me.I think it is better to send a messasge to the main article for MFC grid.
I got the errors compiling the DbMFCGrid.cpp file, not in the original Grid Control, that is why I have posted here. Haven't you wrote the DbMFCGrid.cpp?
(line 260) var.bstrVal = (_bstr_t)GetItemText(j, i+1).GetBuffer();<br />
<br />
<br />
(line 279) pRecordset->AbsolutePosition = (PositionEnum_Param)(iRow);<br />
<br />
Marco.
|
|
|
|
|
Well I don't know ,GetBuffer has two overload version,you can look in MSDN.What is your VC version?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
I'm using VC6 and the only GetBuffer present is the one I mentioned.
Marco.
|
|
|
|
|