|
hi~ i'm a begginer of vc++.
i just wany to create a small program.
so, i didn't use dialog and doc/view strucrture.
it seems not work on typical win32 application?
Thanks~
|
|
|
|
|
How to make the grid control transparent ?
Also if I have multiple grid controls on my View, how do I select more than one at a time ?
|
|
|
|
|
First of all, thanks for the great work!
While I tried to include the control in my own Dialog (as a custom control), my dialog did not appear anymore. It seems, I was not the first user facing this problem.
I found the solution in a user forum:
http://www.codeguru.com/forum/showthread.php?t=344824
I thought it may be worth posting this here, to save other guys' time...
Problem
-----------------------
1) created a solution with an MFC Application project (dialog based)
2) added a custom control to the dialog
3) Set the new control's class to MFCGridCtrl
4) Added all the .cpp and .h files for MFCGridCtrl files to the project
5) Placed #include "GridCtrl.h" in testDlg.cpp
6) Compiled
When run DoModal returns -1.
Investigating using debug the problem seems to be in:
dlgcore.cpp function CWnd::CreateDlgIndirect(..), just after AfxHookWindowCreate(this); (about line 315) there is:
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc);
hWnd remains null after this call and the GetLastError that follows returns 0.
A little later hWnd is tested for null and if true some debug statements are shown then FALSE is returned.
Solution
------------------------------------
Re: about Custom Control
Thank you - exactly the answer that I had been searching for. the steps I took were:
1) moved '#include "GridCtrl.h"' from testDlg.cpp to testDlg.h
2) declared variable 'CGridCtrl m_gridCtrl' in testDlg.h
3) added 'DDX_GridControl(pDX, IDC_CUSTOM1, m_gridCtrl);' in DoDataExchange
4) Recompiled
...
Andy
|
|
|
|
|
It really work.
Thank u so much!
God bless kind-hearted guy!
|
|
|
|
|
Hi,
I did exactly the same.
1. Added Custom Control in Resource View via Toolbox
2. Set the control's class to MFCGridCtrl via PropertySheet
3. Added all the files to the project
4. Placed #include "GridCtrl.h" in *.h
5. declared variable CGridCtrl m_gridCtrl in *.h
6. added "DDX_GridControl(pDX, IDC_GRIDCTRL, m_gridCtrl);" in DoDataExchange
result of DoModal() is still -1. Without the custom control the dialog pops up.
Anybody has a clue?
|
|
|
|
|
Hi,
I add afx_msg void CMyView::OnContextMenu(.....), But it won't be called when I right click button on mouse. But the GridDemoDlg example works.
I noticed in CGridCtrl::OnRClick(), it call CWnd::OnRClick() which invokes OnContextMenu().
in the dialog demo example, CGridDemoDlg::OnContextMenu() is called, why won't work in the Doc/View example?
thanks
|
|
|
|
|
I have use'd Grid ctrl in a View .It worked.But I finded I can't set the Item unless the View is being actived.
I creat a function like this:
void CMyAppView::Filesave(CString path)
{
m_pGrid->SetItemText(0,0,"str");
AfxMessageBox("save");
}
When I called this function in CMyAppDoc.
The Msgbox is done.
But SetItemText doesn't work.
How can I do this problem?
|
|
|
|
|
Hi,
I am new to MFCs. So, I will appreciate any help in this regard.
I am using Chris Maunder's grid control. However, the horizontal scroll bar control (not the scroll box postion but the control postion) starts from the extreme left of the grid control application. How can I start the control from a specified (x,y) position. I need to have the control start from below column 1. Because, I will be placing another control beneath column0.
Please note, I am talking about the actual scroll bar control position and not the scroll box position itself.
Thank you!
vishwa
|
|
|
|
|
I want to load file text to grid using menu item as ID_FILE_OPEN. How can I do??
|
|
|
|
|
How can I use events like OnGridEndEdit or OnGridStartEdit or OnGridStartSelChange or OnGridEndSelChange when Text changes using it in a comboBox in view?
How can I use ComboBox events have a look of CBN_EDITCHAGE events?
Thanks in advance for your help
d
-- modified at 3:23 Monday 9th January, 2006
|
|
|
|
|
m_pGrid->Create(rect,this,100) except a critical error.
i think in mfc library CWnd::CreateEx(...
Why?
|
|
|
|
|
I asked this once before, but never got a response, so can someone please help me.
I have a CView that creates the CGridCtrl object, but my CView is not getting any messages like OnChar(). These are grabbed by the Grid Control and never passed up the chain.
How can I make this happen? I need to get these events in the CView.
|
|
|
|
|
Here is how I was able to get it to work. I don't know if it is the right way if anyone has any other suggestions I am more than open to them. You can override your OnNotify in your view and do the following...
if(wParam==m_pGrid->GetDlgCtrlID()) //message is coming from the grid
{
NM_GRIDVIEW* pNMHDR;
pNMHDR = (NM_GRIDVIEW*)lParam;
CString szData;
if(pNMHDR->hdr.code == NM_DBLCLK)
{
TRACE("Double clicked on Cell);
*pResult = 0;
return TRUE;
}
}
return CView::OnNotify(wParam, lParam, pResult);
You could switch on the pNMHDR->hdr.code to see and handle the notification accordingly. Look in the Gridctrl.cpp and search for SendMessageToParent and you will see the format of the NM_GRIDVIEW stuct and you will also see the messages that the grid passes to it's parent. You could also catch it in the OnCmdMsg you will have to include the AFXPRIV.H I would put the following code after the suggested code in the article if you are going to do it this way.
if(nID == m_pGrid->GetDlgCtrlID()) //message is coming from the grid
{
if(pExtra)
{
AFX_NOTIFY *notify;
notify = (AFX_NOTIFY*)pExtra;
NM_GRIDVIEW* pNMHDR;
pNMHDR = (NM_GRIDVIEW*)notify->pNMHDR;
if(pNMHDR->hdr.code == NM_DBLCLK)
{
TRACE("Double clicked on Cell);
notify->pResult = 0;
return TRUE;
}
}
}
Hope this helps
|
|
|
|
|
Hi,
In my application, I am using Grid Ctrl for a report.
The no of rows will change dynamically depending upon report type selected.
My problem is , the vertical scroll bar is not visible for a report when i run the application in Windows XP SP2. But the same application when i run on Windows 2000 Professional, the vertical scroll bar is visible .
Can you tell me what may be the problem
Muralidhar
|
|
|
|
|
I wish this would work - why doesn't it work? I solved the previous problem but am now stuck with:
Linking...
GridCtrl.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CTitleTip::~CTitleTip(void)" (??1CTitleTip@@UAE@XZ) referenced in function __unwindfunclet$??0CGridCtrl@@QAE@HHHH@Z$0
GridCtrl.obj : error LNK2019: unresolved external symbol "public: __thiscall CTitleTip::CTitleTip(void)" (??0CTitleTip@@QAE@XZ) referenced in function "public: __thiscall CGridCtrl::CGridCtrl(int,int,int,int)" (??0CGridCtrl@@QAE@HHHH@Z)
GridCtrl.obj : error LNK2019: unresolved external symbol "public: void __thiscall CTitleTip::Hide(void)" (?Hide@CTitleTip@@QAEXXZ) referenced in function "protected: void __thiscall CGridCtrl::OnHScroll(unsigned int,unsigned int,class CScrollBar *)" (?OnHScroll@CGridCtrl@@IAEXIIPAVCScrollBar@@@Z)
GridCtrl.obj : error LNK2019: unresolved external symbol "public: void __thiscall CTitleTip::Show(class CRect,char const *,int,struct tagRECT *,struct tagLOGFONTA const *,unsigned long,unsigned long)" (?Show@CTitleTip@@QAEXVCRect@@PBDHPAUtagRECT@@PBUtagLOGFONTA@@KK@Z) referenced in function "protected: void __thiscall CGridCtrl::OnMouseMove(unsigned int,class CPoint)" (?OnMouseMove@CGridCtrl@@IAEXIVCPoint@@@Z)
Debug/gc.exe : fatal error LNK1120: 4 unresolved externals
Arghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!
|
|
|
|
|
Check out whether you have added the source Grid files to the project from within Visual Studio? I mean in VC++ 6 Project -> Add To Project -> Files. I used to run into such messages when forgetting to add the files to the project itself
|
|
|
|
|
Genius! I'm quite embarrassed though!
|
|
|
|
|
gcView.obj : error LNK2019: unresolved external symbol "public: int __thiscall CGridCtrl::SetColumnCount(int)" (?SetColumnCount@CGridCtrl@@QAEHH@Z) referenced in function "protected: virtual void __thiscall CgcView::OnInitialUpdate(void)" (?OnInitialUpdate@CgcView@@MAEXXZ)
I get this for any function I use from CGridCtrl. What am I doing wrong?
|
|
|
|
|
pleas modify the command "m_arColWidths.InsertAt(nColumn, (int)0);"
to m_arColWidths.InsertAt(nColumn,(UINT)0);
WILSON
A LIKE SOFTWARE AND QUALITY MAN
|
|
|
|
|
This happens when I build:
Compiling...
StdAfx.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Compiling...
GridCtrlDemoDlg.cpp
GridCtrlDemo.cpp
GridCtrlDemo.cpp(44) : warning C4996: 'CWinApp::Enable3dControls' was declared deprecated
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4369) : see declaration of 'CWinApp::Enable3dControls'
GridURLCell.cpp
GridCellCombo.cpp
TitleTip.cpp
GridCtrl_src\TitleTip.cpp(314) : error C2360: initialization of 'pts' is skipped by 'case' label
GridCtrl_src\TitleTip.cpp(275) : see declaration of 'pts'
GridCtrl_src\TitleTip.cpp(315) : error C2360: initialization of 'pts' is skipped by 'case' label
GridCtrl_src\TitleTip.cpp(275) : see declaration of 'pts'
InPlaceEdit.cpp
GridDropTarget.cpp
GridCtrl.cpp
GridCtrl_src\GridCtrl.cpp(2214) : warning C4244: 'initializing' : conversion from 'ULONGLONG' to 'DWORD', possible loss of data
GridCtrl_src\GridCtrl.cpp(3490) : error C2668: 'CUIntArray::InsertAt' : ambiguous call to overloaded function
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxcoll.h(341): could be 'void CUIntArray::InsertAt(INT_PTR,CUIntArray *)'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxcoll.h(338): or 'void CUIntArray::InsertAt(INT_PTR,UINT,INT_PTR)'
while trying to match the argument list '(int, int)'
GridCtrl_src\GridCtrl.cpp(3565) : error C2668: 'CUIntArray::InsertAt' : ambiguous call to overloaded function
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxcoll.h(341): could be 'void CUIntArray::InsertAt(INT_PTR,CUIntArray *)'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxcoll.h(338): or 'void CUIntArray::InsertAt(INT_PTR,UINT,INT_PTR)'
while trying to match the argument list '(int, int)'
GridCellBase.cpp
GridCell.cpp
Generating Code...
c:\documents and settings\richard\my documents\grid\gridctrl_demo221\gridctrl_demo221\newcelltypes\gridcellcombo.cpp(455) : warning C4702: unreachable code
c:\documents and settings\richard\my documents\grid\gridctrl_demo221\gridctrl_demo221\newcelltypes\gridcellcombo.cpp(456) : warning C4702: unreachable code
Build log was saved at "file://c:\Documents and Settings\Richard\My Documents\Grid\gridctrl_demo221\gridctrl_demo221\Debug\BuildLog.htm"
GridCtrlDemo - 4 error(s), 4 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
|
|
|
|
|
I have modified your code that if WS_TABSTOP is not on, then OnLButtonDown will not call SetFocus(). This is very important for our touch screen POS system.
and also can you add column default font? usually display text description on one column and dollar amount on other.
eric feng
www.infospec.com
|
|
|
|
|
Well I'm quite new to MFC programming, so this might be a more general question. How can I Capture one of the GridCtrl specific messages in my View? For example the begin editing Message?
Thnx for any answers..
Sebastian
|
|
|
|
|
Hi,
We have downloaded a Grid Control project from Code project named GridCtrlDemo.
While creating dynamically i need to add a vertical scroll bar to the control.
Can any one help me in this regard.
Nandini
|
|
|
|
|
I Can't Find "mfc42u.lib" File.
LINK : fatal error LNK1104: cannot open file "mfc42u.lib"
Error executing link.exe.
Creating browse info file...
|
|
|
|
|
Sounds like you need to have unicode support and you're probably not going to get it. (IE I don't think MS ever expects to release anything for 9X world) Search the project settings and header files for #define's. I havn't actually downloaded this code, but somewhere in it it's referencing the UNICODE version of MFC.
<<edit>>
I don't know if the code has been updated or not, as I probably should of downloaded it before I posted a solution. The current project settings have support for both UNICODE and ANSI modes (Look at the different project settings). If you're in the 9X world, just select "Win32 Release" or "Win32 Debug" from the all ready defined project settings.
|
|
|
|