|
Your worker thread should post a message to the main (the GUI) one and let the latter updating the list.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is MFC out of date? Should I learn it by heart,any body can help me?
|
|
|
|
|
Archy_Yu wrote: Is MFC out of date?
I dont think so, since VC2008 is having MFC Feature Pack...
Archy_Yu wrote: Should I learn it by heart
I am against learning something byheart... because RAM in our brain is precious, so dont waste its space... (I like Sherlock Homes)
Archy_Yu wrote: any body can help me?
What help you are expecting?
- ns ami -
|
|
|
|
|
Anyway, you have to learn (at least) about all varieties of mud you may find in England's countryside.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That's a nice answer... Hope you are much interested of him...
- ns ami -
|
|
|
|
|
i am very happy, you could answer my question. i am a Chinese,and not very much good at English,usually i would ask my tecknoly problem on MSDN. but you answer just encourage me to ask question on CodeProject,and i am determined to study English very good to
use it as fluent as my mother tong.
enjoy you answer.i would like make a friend with you.
|
|
|
|
|
Archy_Yu wrote: i am a Chinese,and not very much good at English
You could really convey what you need... so not that much bad in language...
Archy_Yu wrote: i would like make a friend with you
I am very happy to get a friend from a great country...
- ns ami -
|
|
|
|
|
Hey ppl,
I got stuck with this pure thing.. I got a class which contains pure functions:
virtual void OnMouseDown(int Button, int X, int Y) = NULL;
virtual void OnMouseMove(int X, int Y) = NULL;
virtual void OnMouseUp(int Button, int X, int Y) = NULL;
virtual bool OnRender(void) = NULL;
And I have a derived class which overrides these methods:
bool OnRender(void);
void OnMouseDown(int Button, int X, int Y);
void OnMouseMove(int X, int Y);
void OnMouseUp(int Button, int X, int Y);
But the compiler says:
Error 5 error C2535: 'void CXWindow::OnMouseDown(int,int,int)' : member function already defined or declared
Error 6 error C2535: 'void CXWindow::OnMouseMove(int,int)' : member function already defined or declared
Error 7 error C2535: 'void CXWindow::OnMouseUp(int,int,int)' : member function already defined or declared
Error 12 error C2535: 'void CXWindow::OnMouseDown(int,int,int)' : member function already defined or declared
Ok! if I remove my override functions compiler says:
Error 22 error C2259: 'CXWindow' : cannot instantiate abstract class d:\my codes\chess\chess\dx.cpp 16
Since I do not override them it says this is abstract!
Ok one more thing that i've noticed: OnRender method is also defined pure abstract but I do not get any error about that! Only difference is it does not contain any parameter and returns bool...
thank you in advance...
|
|
|
|
|
Some of the function names are the same as those used by MFC.
Change the names and it should work.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
wow you are totaly right...
i did change their names and it worked...
i do not use MFC in my app but still I add windows.h, windowsx.h..
anyways... thank you very much..
|
|
|
|
|
dehseth wrote: virtual void OnMouseDown(int Button, int X, int Y) = NULL;
virtual void OnMouseMove(int X, int Y) = NULL;
virtual void OnMouseUp(int Button, int X, int Y) = NULL;
virtual bool OnRender(void) = NULL;
Pure virtual functions should be assigned 0 not NULL . It's merely a coincidence that NULL has a value of 0 .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi everybody
I am drawing a graph.The Y Axis of the graph is derived from CWnd and is attached to the left end of my view class which is derived from CSrollView.
So while horizontal scrolling of my view class i want to keep the Y Axis stationary.
Can anybody help me to prevent this particular portion of the view from being updated while horizontal scrolling.
Thanks and regards
Deepu
|
|
|
|
|
I haven't tried, but I felt that it will work. (It's a little bit complicated.)
Make a region with a rectangular hole for the Y Axis window and set it to the scrollview. So you will get space to place the Y Axis window. The parent of Y Axis window should be the same of that of scrollview. Position the Y Axis window right there.
Steps to make such a region can be as follows
1. Create a rect-region with size of scrollview.
2. Create another rect-region with size and position of Y Axis window.
3. Combine both regions
Apply this combined region to scrollview.
- ns ami -
|
|
|
|
|
Thanks for the reply
I did the same before.
I am having a class CGraphicsView derived from CScrollview
Then CYAxis derived from CWnd
Then i am dynamically creating the CYAxis to CGraphicsView in OnCreate function.
Then in OnDraw function i am displaying the CYAxis.
But the problem i am facing is that while horizontal scrolling the YAxis values is getting disturbed ie is not aligned properly.
|
|
|
|
|
Can you please show some relevant code snippet of CYAxis creation, region creation and setting, and positioning of CYAxis?
- ns ami -
|
|
|
|
|
YAxis is created inside CGraphicsView as follwing
int CGraphicsView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CScrollView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//CYAxis m_wndYAxis2;
if (!m_wndYAxis2.Create(0,0,WS_BORDER|WS_CHILD,
CRect(0,0,50,150), this, 0 ))
{
TRACE0("Failed to create Power Bar\n");
return -1; // fail to create
}
m_wndYAxis2.InitializeVariables();
return 0;
}
Positioning of YAxis is done inside OnDraw() function
void CGraphicsView::OnDraw(CDC* pDC)
{
//------------------- my code ---------------------------
CChildFrame* pChildFrame = NULL;
pChildFrame = (CChildFrame* )this->GetActiveWindow();
CSize size = GetTotalSize();
if ( pChildFrame!=NULL )
{
CRect rectFrm;
pChildFrame->GetWindowRect( rectFrm );
m_wndYAxis2.SetWindowPos(&wndTop, rectFrm.left, rectFrm.top,rectFrm.right/12, size.cy, SWP_SHOWWINDOW );
}
}
Please help me if u get any clue.
|
|
|
|
|
But you are not using a region clip as I suggest. In that case you need to create the CYAxis window with parent as scrollview's parent (Instead of 'this', you need to pass 'GetParent()').
As I said earlier my solution would be complicated. You can try for the other reply too that you got...
- ns ami -
|
|
|
|
|
Your problem has an easy solution...
In your CMyScrollView::OnDraw function, just call GetScrollPosition, and add the ptScroll.x value to your drawing code for the Y scale.
I might be 100% wrong and you need to subtract the ptScroll.x value instead, but you can find that out faster than I can!
It won't be flicker free, but it will help. For a flicker free solution, you'll have to get more complicated. I use my own view class and handle scrolling myself, and also make a non-zero nonclient area around the edge for a scale / ruler. But that's too much for a quick forum reply!
Good luck,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks Ami and Iain for your replies..I am trying in all ways possible.
modified on Monday, February 23, 2009 3:02 AM
|
|
|
|
|
I put up a post around a week ago asking for some help to fix a broken class view in visual studio 2008 which prevent me from seeing class function in the tool bar.
Although I recived a couple of replies they did not help. I decided to try to repair my class view this morning.
I have repaired the class view by backing up all of the classes which were not visable. Then deleting the classes from my project and creating new classes with the same names as the broken classes. And finaaly copying back the backed classes to the project over writing the new ones.
I can now see all my classes in the class view and have access to all the function from the tool bar.
Hope this is useful.
Desmond Mardle
RF/ATE ENG
|
|
|
|
|
Update
Restarted browser and all my hard work dissipeared.
I will keep trying to fix this problem.
Desmond Mardle
|
|
|
|
|
Hi Friends,
I am new to code project, so I want to say a hello to all of you. and I am also new to programming. So I have a problem for you.
Can anybody please write a C++ code for solving Travelling Salesman Problem using dynamic programming algorithm?
Thanking You.
|
|
|
|
|
Hi, welcome in the C++/MFC forum. As you're new, I strogly suggest reading carefully the messagge at the top of the forum [^] before posting any question (for instance, "please send me code that solve my problem" should be avoided here).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I think you are not aware of this forum much, I sincerely suggest you to google for any code (if available) that you needed. And once you tried that and tired , then asking for help to solve that issue will help you.
- ns ami -
|
|
|
|
|
Runish Kumar wrote: Can anybody please write a C++ code for solving Travelling Salesman Problem using dynamic programming algorithm?
Yes, I'm sure somebody can.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|