|
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.
|
|
|
|
|
I'm running on WINXP Pro. Tried compiling under both VC++.net and VC++6 same error in both.
Any ideas where to download the MFC unicode version?
[edit] i think ive found it in SP2 for VC++6
|
|
|
|
|
find mfc42u.lib file or
in your VC , Build -> Set Active Configuration ->
Select Win32 Debug or Win32 Release
Cheers!!
|
|
|
|
|
mfc42u.lib File not found
|
|
|
|
|
because
error LNK1104: cannot open file "mfc42u.lib"
...........
.........
...........
|
|
|
|
|
How can I use events like OnGridDblClick or OnGridClick when using it in a view ?
Thanks in advance for your help
|
|
|
|
|
In the resource editor, add a new Resource Symbol for the Grid, like IDC_GRID
After you create the grid control, use SetDlgCtrlID() to assign it the ID like the following:
<br />
m_pGridCtrl = new CGridCtrl;<br />
if (!m_pGridCtrl) return;<br />
<br />
CRect rect;<br />
GetClientRect(rect);<br />
m_pGridCtrl->Create(rect, this, 100);<br />
m_pGridCtrl->SetDlgCtrlID(IDC_GRID);
In your view class message map you can then add the notify commands and appropriate handlers just as in the Dialog based version, I.E.
<br />
ON_NOTIFY(NM_CLICK, IDC_GRID, OnGridClick)<br />
ON_NOTIFY(NM_DBLCLK, IDC_GRID, OnGridDblClick)<br />
-HTH
|
|
|
|