|
Ahhh, yes, you're right. Your idea does work. I just needed to additionally modify the OnSize. Thanks again for your help! I really appreciate it.
|
|
|
|
|
Great article - I've found it very helpful. My question is - what is the best way to let the document know that the data has been modified in the view (which contains the grid control)? I want the framework to prompt the user to save the document if it has been modified. I already have the serialization working (thanks to Holger Persch).
Tom Pruett
|
|
|
|
|
Get a pointer to the document and then call CDocument::SetModified
cheers,
Chris Maunder
|
|
|
|
|
I've tried to have the grid gain the focus when a new child window is opened or when the user switch back to the grid demo application.
I've added a handler for OnActivateView:
<br />
void CGridViewDemoView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) <br />
{<br />
CView::OnActivateView(bActivate, pActivateView, pDeactiveView);<br />
if (bActivate && this == pActivateView)<br />
m_pGridCtrl->SetFocus();<br />
}<br />
But that doesn't seem to do anything...
Any idea someone ?
Pierre Meindre
|
|
|
|
|
Did you try the OnSetFocus?
void CGridViewDemoView::OnSetFocus(CWnd* pOldWnd) <br />
{<br />
CView::OnSetFocus(pOldWnd);<br />
if (m_pGridCtrl && IsWindow(m_pGridCtrl->m_hWnd)) m_pGridCtrl->SetFocus();<br />
}
|
|
|
|
|
Thanks for your answer.
Is it working for you ?
I've just added a WM_SETFOCUS handler as you suggested,
it get called indeed (down to the m_pGridCtrl->SetFocus()
call) but... nothing more is happening!
What I want to acheive is to have the focus set on the grid
so using the keyboard is active: moving the current cell with
the cursor keys, pressing F2 or Enter to edit a value...
|
|
|
|
|
Ok, I made a try... it worked this way:
void CMyView::OnSetFocus(CWnd* pOldWnd) <br />
{<br />
CView::OnSetFocus(pOldWnd);<br />
<br />
if (m_pGridCtrl && IsWindow(m_pGridCtrl->m_hWnd))<br />
{<br />
m_pGridCtrl->SetFocus();<br />
<br />
int x = m_pGridCtrl->GetFixedColumnCount();<br />
int y = m_pGridCtrl->GetFixedRowCount();<br />
m_pGridCtrl->SetFocusCell (y,x);<br />
m_pGridCtrl->EnsureVisible(y,x);<br />
}<br />
}
|
|
|
|
|
What the best way to save grid control in CDocument class with Serialize function?
|
|
|
|
|
Row selection doesn't work for me like normal window row selection.
I left click on a row and it selects. I left click on it a second time and it unselects. I would like it to stay selected, like in Windows Explorer etc. (In Windows Explorer click on the icon in font of the file name.) Row selection is fine if I move the mouse a little before the left button up.
I'm working with MFC Grid Control v2.23. The problem seems to be that on line 6158 in CGridCtrl::OnLButtonUp does ResetSelectedRange.
My grid is read-only and enabled for drag-and-drop.
If anyone has a fix for this, I'd appreciate it. Otherwise I'll look at it some more. If I figure out a fix, I'll post it.
|
|
|
|
|
See my fix under the project "MFC Grid control 2.23".
|
|
|
|
|
|
Hi,
When i tried to add a member variable of type CGridCtrl* to the view class as u said like...
in ".h" file of CView derived class
CGridCtrl* m_pGrid;
the compiler gives some error.
So, i did downloaded your application and tried to run, again it was the same error.
The compiler(MSVisual Studio 6.0) errors are...
error C2143: syntax error : missing ';' before '*'
error C2501: 'CGridCtrl' : missing storage-class or type specifiers
Errors:.....
Can i have some explanation please?
Thanking you
Regards
Mohan
|
|
|
|
|
Have you include 'GridCtrl.h' in the "MyView.h" file of your CMyView
|
|
|
|
|
Have you included 'GridCtrl.h' in the "MyView.h" file of your CMyView
|
|
|
|
|
The control won't compile under UNICODE. Does anyone have a UNICODE compliant version?
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
The control has always compiled under Unicode. What errors are you seeing?
cheers,
Chris Maunder
|
|
|
|
|
Hi,
Using your example, GridCtrlDemo, say i have 2 columns in the grid. The 2nd column
contains a verry looong string within one of it's cells. Say you then resize the dialog smaller(resize dialog towards your left). A horizontal scroll bar then appears at the bottom of the grid. But if you notice, when you scroll the bar, the 2nd column gets cut off (you cannot see the full contents of the string of the long data). Does anyone know how to modify the grid, such that when someone resizes the dialog, the user can still
scroll the whole data? or is this impossible?
Thank-you!!!!!!!
Eric
|
|
|
|
|
Doesn't anyone can tell me how to do it?Please!
|
|
|
|
|
I had built this program and I got the following error.
fatal error LNK1104: cannot open file "mfc42u.lib"
Please help.
I am just a beginner.
Cheolsoon
|
|
|
|
|
Hi all
I really need this bad, I got the grid, but i need to capture any changes in cell data. Its like this when a cell data is changed simultaneously i need to change another variable whoes value depends on the cell data. It would take lot of time if I try to compare teh values of each cell with respective previous values and then change teh variable value. So any suggestions how to do it?/
Thank you
Cheers
|
|
|
|
|
Please tell me how to merge the cells, you know, in the table-making work, we always need merge the cells to make them to be a large cell, just like the merge function in Exell.
Tell me please, thanks a lot.
|
|
|
|
|
Anyone know how to wrap text onto multiple lines within a cell?
defualt behaviour is to spill text out the right side.
Thanx,
Robert
Robert-laird@home.com
|
|
|
|
|
I have used this grid as in splitter view as one of the four views.
And succesfully draw the grid inthat view,but iam unable to resize the cols and rows size by dragging the mousefrom the edge of the cell.
please help me.
Also I am unable to trap Mouse generated messages e.g. OnLButtonDown.
What happens is that the control always go to CGridCtrl's trapped message.
Please help me
leens
|
|
|
|
|
Hi Chris,
I've included your great control in my application and I've added a image (SetItemImage(..) call) to the cells. No problem until now, and it works fine in the debug build , but when I make a release build, my application crashes . If I don't set the image (no SetItemImage(..) call) my application also works fine in the release build.
I'm using VC++ 5.0 SP3
I realy like your control, perhpaps you or one of the other users has an idea for a workaround.
Ralph
|
|
|
|
|
I need to implement the following behaviour:
when the user clicks upon a cell, if certain condition is true,
a messagebox appears.
How ever, after the messagebox is closed, when moving the mouse over the
grid - the grid acts as in mode of "multiple selection" - like every cell
on which the mouse hovers - gets marked as "selected".
please help me to avoid this phenomena!
thank U, Eynat s.
|
|
|
|