If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
hi i need help with this code, i dont know what it does. Please somebody explain what each line does so i can rewrite it to suit other similar functions
void MyFrame::CreateBST(wxCommandEvent& WXUNUSED(event))
{
string word;
wxString wxWord;
// Clear the edit box
MainEditBox->Clear();
//open the file
ifstream infile( CurrentDocPath.mb_str(), ios::in); // ".mb_str()" gets the "string" from "wxString"
while (!infile.eof())
{
infile >> word; // Get one word
// word = strip(word); // strip the word and lowercase it
if ( (word.length() > 0) && (!infile.eof()) )
{
//Insert the word into the BST
bst->insertNode(word);
//Display the word in the MainEditBox
wxWord = wxString(word.c_str(), wxConvUTF8); // Convert word to proper wx format for appending
MainEditBox->AppendText( wxWord ); // Append the converted word
MainEditBox->AppendText( wxT("\n") ); // Change line after each word is appended
}
}
}
Sorry your question is very vague. I think this code is very explicit and well documented, apart maybe from "bst" but I assume from the larger context you can see what bst is.
So please more precise questions, explaining line by line what happens is pretty much already done since most lines are commented
"Keyboard not detected. Press F1 to continue"
-- Windows
jloxy wrote:Ok so how would I write a "create queue " from this ?
I'm sorry I don't understand what you are talking about. "Writing a create queue" does not seem to make much sense to me, and I don't see the link with the snippet posted
"Keyboard not detected. Press F1 to continue"
-- Windows
Isn't that already some kinde of "create queue"?
It reads a number of words from the file and "creates" the EditBox text with that words one after the other.
Should you maybe rewrite that code using another kind of loop for example "for" instead of "while"?