| |

VerySource

 Forgot password?
 Register
Search
View: 966|Reply: 7

Split windows, load tree controls for one of them? ? ?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-15 06:30:01
| Show all posts |Read mode
Thanks to my colleagues who saw this question, the questions are as follows:
SDI is divided into 1 row and 2 columns, two windows; how do I load a tree control for one of the windows dynamically?

I tried direct Creat, but it doesn't work, the code is as follows:

m_TreeCtrl.Create (TVS_CHECKBOXES | TVS_EDITLABELS | TVS_FULLROWSELECT |
TVS_HASBUTTONS | TVS_HASLINES | TVS_INFOTIP | TVS_SHOWSELALWAYS, rect, pCwnd, IDC_MYTREE);


bool CMainFrame :: InitTree (void)
{
          ...
          ...
}
Reply

Use magic Report

0

Threads

22

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 United States

Post time: 2020-6-3 21:15:01
| Show all posts
The tree can be dynamically increased in the OnCreate of the view, or directly use a CTreeView
Reply

Use magic Report

0

Threads

22

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-6-4 06:00:01
| Show all posts
CRect rectDummy;
rectDummy.SetRectEmpty();

// Create view
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES |
TVS_LINESATROOT | TVS_HASBUTTONS | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN;

if (!m_wndTree.Create(dwViewStyle, rectDummy, this, 2))
{
TRACE0 ("Failed to create view\n");
return -1; // fail to create
}
Reply

Use magic Report

1

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-21 18:15:01
| Show all posts
The style of the control should be visible and be a child window. WS_CHILD | WS_VISIBLE, or drag it directly with CTREEVIEW or CFORMVIEW.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-26 22:30:01
| Show all posts
A class derived from CTreeView, such as CLeftView, can display tree controls.


Add a member in the CMainFrame class
CSplitterWnd m_wndSplitter;

Implement CMainFrame::OnCreateClient() method, part of the code:
    // TODO: create split view
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
// add-an input view in column 1
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CLeftView), CSize(170, 0), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
         // Add another view using the same method
// activate the input view
SetActiveView((CView*)m_wndSplitter.GetPane(0,1));
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-24 13:45:01
| Show all posts
When creating a project directly, create a resource manager type window, which will automatically split the window, and then dynamically create a tree in CLeftView.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-24 14:00:01
| Show all posts
Try this, take him as the parent window in one of the windows, create a non-modal dialog box, and then you can do whatever you want on it^_^
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-24 14:30:01
| Show all posts
Visual Graph is a powerful interactive graphic development platform. It can easily build graphic-based interfaces, make various graphic elements, realize graphic management, graphic modeling, production monitoring system, form system, drawing system, process design, CAD software, etc. She provides very powerful ActiveX controls and works with other popular programming languages, which greatly compensates for the lack of graphics processing of these languages. It can also be embedded in IE browser to realize online graphic editing and control. http://www.visual-graph.com
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