| |

VerySource

 Forgot password?
 Register
Search
View: 791|Reply: 8

Can anyone help me look at this problem for a long time and don't know why urgent!

[Copy link]

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-17 14:00:01
| Show all posts |Read mode
There is such a derivation relationship CTreeView-> CMyTreeView
Now I added virtual void OnInitialUpdate (); function in the class CMyTreeView using the wizard
Then define it in the response function of a button as follows
void CMainFrame :: OnPre ()
{
// TODO: Add your command handler code here
// Change the query mode
CDicTreeView * pTreeView = (CDicTreeView *) m_wndSplitter.GetPane (0, 0); // returns the view pointer at row 0 and column 0
pTreeView-> OnInitialUpdate (); // Update the view
}
The debugger finds that when the execution reaches the last line, the program goes to execute the OnInitialUpdate (); function in CView. Why is this? I already have it in the CMyTreeView class.
Redefine OnInitialUpdate (); function.
Reply

Use magic Report

2

Threads

20

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 Unknown

Post time: 2020-1-22 18:18:01
| Show all posts
Is the first sentence of your CMyTreeView :: OnInitialUpdate () CTreeView :: OnInitialUpdate ()?
Reply

Use magic Report

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-22 18:45:02
| Show all posts
Yes The first sentence is CTreeView :: OnInitialUpdate ()
Reply

Use magic Report

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-22 19:00:02
| Show all posts
The tracking program can't execute CMyTreeView :: OnInitialUpdate () at all
Reply

Use magic Report

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-22 20:45:01
| Show all posts
I added #include <afxcview.h> to stdafx.h. I saw that someone else's program does not have this line. Does this have anything to do with this? It's no good to get rid of this line now. Error C2653: 'CTreeView': is not a class or namespace name
Reply

Use magic Report

2

Threads

20

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-23 06:00:01
| Show all posts
Certainly it has nothing to do with that. CView is defined in those header files. How to remove those header files. Is your pointer the CMyTreeView object? Or CTreeView? If it is the former, I don't know why. I think it might be to execute CMyTreeView :: OnUpdate first to execute CTreeView :: OnUpdate. Anyway, there must be some problem, you can look carefully, logically it must be CMyTreeView :: ONUpdate
Reply

Use magic Report

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-23 09:09:01
| Show all posts
The above is wrong and has nothing to do with #include <afxcview.h>

Just wait for the master to help me solve it
Reply

Use magic Report

1

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-23 09:45:01
| Show all posts
Defined CDicTreeView * pTreeView can call other functions of CDicTreeView class, pTreeView pointer should point to CDicTreeView
Reply

Use magic Report

0

Threads

25

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-1-23 10:00:01
| Show all posts
CDicTreeView * pTreeView = (CDicTreeView *) m_wndSplitter.GetPane (0, 0); // returns the view pointer at row 0 and column 0
pTreeView-> OnInitialUpdate (); // Update the view
=============

Don't understand where your CDicTreeView came from
Try:
CMyTreeView * pTreeView = (CMyTreeView *) m_wndSplitter.GetPane (0, 0); // returns the view pointer at row 0 and column 0
pTreeView-> OnInitialUpdate (); // Update the view
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list