|
once is the hint toward speed up hypothesis (but is only a guess, I agree).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi Chris. First of all I am thankful to you for a wonderful grid control with entire source code that u have provided here on CP. Also want to thank for the revisions, additions, add-ons, database connectivity and other utilities related to the MFC Grid posted by various users on CP. I am one person making use of it in one of my applications where there is a requirement to display elements in 2-d/3-d data in a matrix form.
For 2-d arrays it is simple matrix-type table with rows and columns. For 3-d arrays, however, I have to make the cells combo-boxes and display the third dimension elements in the combo box. And I have done it. However, there is a need for my application to get hold of the combo-box inside the cells that is created at runtime. I want to set the contents of my application based on the element selected by the user in the combobox. In short, I want to perform all the operations related to a combo-box, that is created in every cell of the grid. And I want to set the cell text to the selection made by the user in the combo-box, which happens automatically ofcourse. However, after selection, I have to get the index selected inside the combo box and store it in a 2-d int array on the execution of the command button. And conversely I have to set the cell text from a 2-d int array holding the combobox from this array. I am using Visual Studio 2005 and my OS is Windows XP.
Here is the part of the code:
void CTest_GridView::OnInitialUpdate()
{
CTest_GridDoc * pDoc = (CTest_GridDoc*)GetDocument();
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
int count = 0;
for(int a = 0; a < 10; a++)
{
for(int b = 0; b < 10; b++)
{
for(int c = 0; c < 10; c++)
{
count++;
pDoc->m_nDataArray[a][b][c] = count;
}
}
}
this->m_Grid.SetRowCount(m_nRows);
this->m_Grid.SetColumnCount(m_nCols);
this->m_Grid.SetFixedRowCount(m_nFixedRows);
this->m_Grid.SetFixedColumnCount(m_nFixedCols);
CString sz;
for (int x = 1; x < m_Grid.GetColumnCount(); x++)
{
sz.Format(_T("%d"), x);
this->m_Grid.SetItemText(x, 0, sz);
this->m_Grid.SetItemText(0, x, sz);
}
for (int i = 1; i < m_Grid.GetColumnCount(); i++)
{
for (int j = 1; j < m_Grid.GetRowCount(); j++)
{
m_Grid.SetCellType(i, j, RUNTIME_CLASS(CGridCellCombo));
m_Grid.SetItemText(i, j, _T("My Number"));
CString str;
CStringArray options;
for(int k = 0; k < 10; k++)
{
str.Format(_T("%d"), pDoc->m_nDataArray[i-1][j-1][k]);
options.Add(str);
str.Empty();
}
CGridCellCombo *pCell = (CGridCellCombo*) m_Grid.GetCell(i,j);
pCell->SetOptions(options);
pCell->SetStyle(CBS_DROPDOWN);
}
}
}
....
....
....
void CTest_GridView::OnBnClickedButtonFix()
{
CTest_GridDoc * pDoc = (CTest_GridDoc*)GetDocument();
CString sz;
int num = -1;
for (int i = 1; i < m_Grid.GetColumnCount(); i++)
{
for (int j = 1; j < m_Grid.GetRowCount(); j++)
{
CGridCellCombo * pCell = (CGridCellCombo*)m_Grid.GetCell(i, j);
CWnd * pWnd = pCell->GetEditWnd();
CComboBox * pCmb = (CComboBox*)pWnd;
if(pCmb->GetCurSel() != CB_ERR)
num = pCmb->GetCurSel();
else
num = 0;
pDoc->m_nIndexArray[i-1][j-1] = num;
pCmb->GetLBText(num, sz);
pDoc->m_nComboText[i-1][j-1] = sz;
sz.Empty();
}
}
}
I am using Visual Studio 2005 and the OS is Windows XP SP2. I have used a formview in a SDI application to display the grid and the button.
Thank you,
Bhushan.
|
|
|
|
|
It seems you used of Chirs's article if you have any question about that article you can ask on that article forum.
|
|
|
|
|
Hey...I tried to do so....but when I went to Desktop Development | Miscellaneous | MFC Grid Control 2.26 link, I was navigated to a page where it said page not found and suggested an alternate location which was having a different link. Even after clicking the link the page would not change! So I do not know where to search. Besides, this site previously had a different layout with a distinct area for Visual C++ programming. Now I do not seem to find those familiar links. However, I had managed to find the link today itself before I posted this message. However, the same location is giving me an error now. This has added to all the clutter and nebulousness. I dunt know what to do. By the way, I thought it would be best to go to Chris Maunder's personal profile page and post my question so that he can help me out with it. Anyway, once I find the article it would be miracle and then I would post my Q there...
Thanks,
Bhushan.
|
|
|
|
|
Well, no articles were opening for about a while. There was a problem with the site and it is resolved now.
You can view the grid control article by clicking here[^].
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi. thank you for the clarification. My other question was, why would CP change the previous design of the website of having a systematic navigation for each of the programming environments?
Thank you,
Bhushan.
|
|
|
|
|
You can still systematically navigate through the website. If you have a genuine problem, you should report it at the site issues forum.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Dear all,
I am working in project that have title "Remote Monitoring Webcam via Internet", so please any pody can help me please
AbU AdAm
|
|
|
|
|
asmarani wrote: so please any pody can help me please
Help you with what?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
remote monitoring with webcams? Probably he failed to sign up for spyonsecksiehotbabes.xxx
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
peterchen wrote: spyonsecksiehotbabes.xxx
never heard about, I shoud definitely add it to my favourites
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
peterchen wrote: spyonsecksiehotbabes.xxx
One of my favorite sites!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Sure - don't make your posts bold, it's annoying.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
asmarani wrote: I am working in project that have title "Remote Monitoring Webcam via Internet", so please any pody can help me please
If you'll change the title to "Hello World", I'm sure the project will be much easier.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I knew that.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Did you have any question?
|
|
|
|
|
Help with what? Also, pick a more descriptive subject line, instead of "Dear all"...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
I need an algorithm that fits an ellipse to x, y points. I looked around online but there is nothing written in C++. Even a methodology to achieve a fit will be good enough and I will be able to write the code.
I also have the center position and all the raw data points. I need a best fit ellipse to it.
Any help would be greatly appreicated.
Thanks
|
|
|
|
|
If you don't mind playing with matrices, here's[^] a "numerically stable non-iterative algorithm for fitting an ellipse to a set of data points" (method of least squares).
/ravi
|
|
|
|
|
Hi,
I saw this from my searching online, but the problem is none of this makes sense to me.
Is there a step by step procedure to solve this problem.
Thanks
|
|
|
|
|
|
All,
Is there an easy way, in an MFC application, to launch and automatically play a .WMV file? I don't want to open Windows Media Player, but instead have this video play inside my application.
Thanks in advance.
|
|
|
|