Click here to Skip to main content
15,919,121 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCDaoIndex Pin
otvac24-Jul-01 15:36
otvac24-Jul-01 15:36 
GeneralRe: CDaoIndex Pin
Doug Garno24-Jul-01 23:27
Doug Garno24-Jul-01 23:27 
QuestionAren't ActiveX controls universal? Pin
Sam C24-Jul-01 15:34
Sam C24-Jul-01 15:34 
AnswerRe: Aren't ActiveX controls universal? Pin
Sam C24-Jul-01 20:36
Sam C24-Jul-01 20:36 
GeneralGetting access to a variable. Pin
John Uhlenbrock24-Jul-01 13:31
John Uhlenbrock24-Jul-01 13:31 
GeneralRe: Getting access to a variable. Pin
Christian Graus24-Jul-01 14:13
protectorChristian Graus24-Jul-01 14:13 
QuestionHow to populate a tree control Pin
nulldreamer24-Jul-01 13:03
nulldreamer24-Jul-01 13:03 
AnswerRe: How to populate a tree control Pin
Doug Garno24-Jul-01 23:43
Doug Garno24-Jul-01 23:43 
Ah, the basic problem of the parent doesn't know that it has any children attached. Change your tvInsert.mask to include TVIF_CHILDREN and set the tvInsert.cChildren either true or false depending on if the parent has any children.

Another way is to create parents with no children, then when you add children to a parent, tell the parent that it now has children. When you add a child to a parent, call a function like UpdateParentItem( HTREEITEM hParent );

void UpdateParentItem( HTREEITEM hParent )
{
// Can't use ItemHasChildren() because it will always return
// the value of the item.cChildren variable.
// Need to get the first child and update the parent as needed.

// Getting the first child of a parent will always return either
// NULL if no children exist or the handle to the first child
// regardless of the item.cChildren variable.
HTREEITEM hChild = m_pTree->GetChildItem( hParent );

// Set up the item structure
TV_ITEM item;
ZeroMemory( &item, sizeof(TV_ITEM) );
item.hItem = hParent;
item.mask = TVIF_CHILDREN;
item.cChildren = hChild != NULL;

// Update the parent node to reflect the children state.
m_pTree->SetItem( &item );
}

Also make sure that when the tree control is created you set the TVS_HASBUTTONS or you will not see the plus/minus button on the parent. You would have to double click the parent to see if there is any children.
GeneralMultiple Inheritence and MFC Pin
Stan Shannon24-Jul-01 10:24
Stan Shannon24-Jul-01 10:24 
GeneralRe: Multiple Inheritence and MFC Pin
Tomasz Sowinski24-Jul-01 10:46
Tomasz Sowinski24-Jul-01 10:46 
GeneralRe: Multiple Inheritence and MFC Pin
Stan Shannon24-Jul-01 11:52
Stan Shannon24-Jul-01 11:52 
GeneralRe: Multiple Inheritence and MFC Pin
Stan Shannon25-Jul-01 3:21
Stan Shannon25-Jul-01 3:21 
GeneralRe: Multiple Inheritence and MFC Pin
Tomasz Sowinski25-Jul-01 3:42
Tomasz Sowinski25-Jul-01 3:42 
GeneralRe: Multiple Inheritence and MFC Pin
Stan Shannon25-Jul-01 4:06
Stan Shannon25-Jul-01 4:06 
GeneralRe: Multiple Inheritence and MFC Pin
Fazlul Kabir24-Jul-01 11:19
Fazlul Kabir24-Jul-01 11:19 
GeneralRe: Multiple Inheritence and MFC Pin
Stan Shannon24-Jul-01 11:54
Stan Shannon24-Jul-01 11:54 
GeneralProblem with child Wnd(dialogBox) Please HELP !!!! it is very URGENT !!! Pin
24-Jul-01 10:17
suss24-Jul-01 10:17 
GeneralRe: Problem with child Wnd(dialogBox) Please HELP !!!! it is very URGENT !!! Pin
Not Active24-Jul-01 10:29
mentorNot Active24-Jul-01 10:29 
GeneralRe: Problem with child Wnd(dialogBox) Please HELP !!!! it is very URGENT !!! Pin
Jake Palmer24-Jul-01 10:36
Jake Palmer24-Jul-01 10:36 
GeneralBlinking Static Text Pin
John Uhlenbrock24-Jul-01 10:13
John Uhlenbrock24-Jul-01 10:13 
GeneralRe: Blinking Static Text Pin
Christian Graus24-Jul-01 11:31
protectorChristian Graus24-Jul-01 11:31 
GeneralRe: Blinking Static Text Pin
John Uhlenbrock24-Jul-01 12:28
John Uhlenbrock24-Jul-01 12:28 
GeneralRe: Blinking Static Text Pin
Christian Graus24-Jul-01 12:45
protectorChristian Graus24-Jul-01 12:45 
GeneralRe: Blinking Static Text Pin
John Uhlenbrock25-Jul-01 6:52
John Uhlenbrock25-Jul-01 6:52 
GeneralRe: Blinking Static Text Pin
John Uhlenbrock25-Jul-01 7:10
John Uhlenbrock25-Jul-01 7:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.