Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CTreeCtrl - Update question

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hello,

I am not usually programming C++, so this question is probably simple to many of you.

I am making a user interface where a CTreeCtrl with only one level and checkboxes is going to represent different paths to executable files on that computer. This part of the program is to load a list of filenames from a textfile and then display those files in the tree, and if they exist on that computer have its checkbox checked.

I think that I have the code correct... but something must be missing, or I am simply just wrong :-) because I set the boxes checked in the code, but they do not become checked in the user interface.

I write the code below in a dialog's onInitDialog().

m_tree is defined in the dialog class ( CTreeCtrl m_tree; )

// ** FileReader is a class that reads in a textfile and you can then acces each line seperatly ***

// ** fileSearchWithPath(...) is simply a global function that tests if the file exists (with fopen()) **

// ****************************************************
// ****************************************************
FileReader inFile("C:/temp/programs.txt");
int numLines = inFile.getNumberOfLines();
for (int i = 0; i < numLines; i++)
{
HTREEITEM myItem = m_tree.InsertItem(inFile.getLine(i));
if (fileSearchWithPath(inFile.getLine(i)))
{
m_tree.SetCheck(myItem, TRUE);
}
}

If someone could help me i would be very grateful.

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top