|
One solution is to create the l/p dialog window in OnInitDialog() or OnInitUpdate().
Kuphryn
|
|
|
|
|
I don't quite under stand what your gettin at, Sorry.
|
|
|
|
|
One solution is SetWindowPos().
Kuphryn
|
|
|
|
|
Hi there.
I'm trying to make program that can read a tabulated text file and show that in a grid. I got it to work but I'm not satisfied with the speed of it.
CString Text;
string buf;
ifstream file(FilePath);
BOOL bLineEnd = true;
int i = 0, nRowCount = 1, nColCount = 0;
m_pGrid->SetColumnCount(0);
m_pGrid->SetRowCount(0);
m_pGrid->SetRedraw(FALSE);
getline(file, buf, '\n');
while(!file.eof())
{
m_pGrid->SetRowCount(nRowCount+1);
while(bLineEnd)
{
bLineEnd = AfxExtractSubString(Text, buf.begin(), i, '\t');
if(bLineEnd)
{
if(nColCount <= i+1) m_pGrid->SetColumnCount((nColCount = i+1)+1);
m_pGrid->SetItemText(nRowCount, i+1, Text);
}
i++;
}
i=0;
bLineEnd = true;
nRowCount++;
getline(file, buf, '\n');
}
m_pGrid->SetRedraw(TRUE);
I'm using Chris Maunder's MFC Grid Control to do this.
I hope that someone have a faster way to do this.
|
|
|
|
|
One speed up would be not to use AfxExtractSubString, since it will have to do multiple scans of the string to get the one you want. Where the number of columns is small it's probably not noticeable, but as this climbs...
Steve S
|
|
|
|
|
Hi all,
Can someone help me fix and understand why this doesn't work. I keep getting an error saying:
error C2079: 'Node::data' uses undefined class 'T' with[ T=T]
Here is my code;
template <class T>
class Node
{
public:
Node * link;
Node(T x=0, Node* A = NULL): data(x), link(A) {}
T data;
};
typedef Node<class T> nodePtr;
HELP PLEASE...this is driving me crazy?
|
|
|
|
|
You need to check the box that says 'do not treat '<'s as HTML tags, then you need to post your question once only, and finally, you might consider using some sort of moniker, rather than posting anonymously. If you fulfill the first of these, so I can read your code, I'd be happy to look at it for you.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Sorry about that, I forgot to log in before. Sorry also about the double post. Here is the code....
template <class T>
class Node
{
public:
T data;
Node * link;
Node(T x=0, Node* A = NULL): data(x), link(A) {}
};
typedef Node<class T>* nodePtr;
Many thanks in advance
|
|
|
|
|
Like Mike said....
typedef's generally suck anyhow, they mean relying on the IDE or a search all to figure out what something actually *is*.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Actually, maybe I'm wrong, and you've simply not defined your template at all. In that case, you'd get this error, as the class T does not exist. You need to do this:
template<class T> Node
{ // etc
But what is the typedef for ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
The offending line is:
typedef Node<class T> nodePtr;
This is not legal because you aren't defining T here. You can't make a typedef without specifying the template parameters (at least not in VC 6, maybe with PTS you can, but that's off-topic) because a template is just something that generates code, it is not a type. You could do this:
typedef Node<int>* nodePtr;
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
typedef templates are not part of C++ standard, but they are planned for the next version. At least Herb Sutter seems to be very enthusiastic about them.
|
|
|
|
|
The following code compiled correctly:
template <typename T>
class Node { public: T data; };
typedef template<typename T> Node<T>* pTnode;
pTnode<int> p;
Hosam Aly Mahmoud
|
|
|
|
|
|
Microsoft Visual C++ 6.0 with SP5. I said it compiled, but I did not run it.
Hosam Aly Mahmoud
|
|
|
|
|
Hi all,
Can someone help me fix and understand why this doesn't work. I keep getting an error saying:
error C2079: 'Node<T>::data' uses undefined class 'T' with[ T=T]
HELP PLEASE...this is driving me crazy?
|
|
|
|
|
well.....since you don't give me that much information to work with, i'm thinking that you defined a template class like so:
template <class t=""> (or <typename t="">)
class CTempl
{
CTempl<t>();
};
and implemented your methods like this:
CTempl<t>::CTempl<t>(){}
This result in a similair error as you described and it means you haven't included the following statement, above the method impl.:
template <class t="">
CTempl<t>::CTempl<t>(){}
Is this what you mean, or did i type all this for sh*t?
|
|
|
|
|
The file I added, was actually present in the project workspace before, under a different name. Following some changes I made to the file, I gave it a new name, and then deleted the old version from the workspace, followed by adding the newly named one to the same workspace (using Project->Add To Project->Files). Other changes made, were to the "#include" statement in the program, and the directory where the program and its files are located.
Did a "Rebuild All" and the compiler came back saying it couldn't open the newly named file.
Any idea why the compiler is not seeing the newly added file in "Dev Studio"??
Thanks!
William
Fortes in fide et opere!
|
|
|
|
|
Switch to the file list and right click on the file to get its properties. Is the file really
where VC thinks it is?
Also, changing files can quite often confuse the poor IDE, so close VC, and delete the projects NCB file.
Run VC again, and do a "Rebuild All". It should be okay now.
Iain.
|
|
|
|
|
Thanks for replying.
Tried your suggestion. It didn't help. The same error keeps getting cited.
Also ran a little experiment. I removed ALL the C++ files the project uses (everyone of them), then did a "Rebuild all" and the same single error returned about not being able to open that newly named file I've been talking about (even though the physical file is no longer in the directory with the ".exe" file. Interestingly, the compiler made no mention about the other files that were removed also. It just said it couldn't find that one file. (Yes, I did delete the ".ncb" file followed by a "Rebuild all".
Dev Studio is a strange creature after all, and it stands to fact I've much to learn about its idiosyncrasies.
William
Fortes in fide et opere!
|
|
|
|
|
By implication, I presume the file you are talking about is not a C/CPP/H file.
It is a dependency of other files in your project (e.g. resource). Do you custom-build
it into an intermediate file which is included in your project?
I would open the project settings and check for mention in your file in any of the
command line parameter bits on the bottom right. This may give you a clue.
Iain.
|
|
|
|
|
The file in question is a C++ file, in that it has ".h" as it's extension.
In reality, it is a MACRO file that I have all sorts of macros in, which as a matter of routine I '#include' it in nearly all my programs. Recently however, I began doing some house cleaning on it, hence the reason for renaming it, and it's that new name that the program is saying it cannot find to open the file (even though the file is physically present in the same directory as the ".exe" file). The same renamed file is also present in the project workspace which when I click on it, I see all the new changes I made to it.
I cannot understand why the compiler is saying it is unable to find the file.
Thanks for your continued suggestions.
William
Fortes in fide et opere!
|
|
|
|
|
by default the file is expected to be in the same directory as the project (.dsp) file, otherwise you need to do one of the following;
a) mangle the include statement in your files (e.g. #include "..\common\abc.h", or
b) add the path via Project -> Settings -> C++ -> Preprocessor -> Additional Include directories.
nb
|
|
|
|
|
Thanks for replying.
I think some confusion is beginning to emerge between the use of the word "folder" and "directory" (and maybe I hold some blame for that).
I use the word "folder" to mean, "a place in a directory where one or more files are located."
"Directory," I use, to denote a path from the drive letter where a certain "folder" is located.
Some of the answers I get (well-intentioned as they are), are beginning to reflect this confusion, which if I can help clear things up, "The newly named file, resides in the same folder (in the same directory) as the ".dsp" file."
Unlike C++ where the programmer can do some rather clever things and the compiler will go along with his code, "Dev Studio" is not very clever. Simply substituting a file by removing the old one from the workspace and "adding in" a new one to the same workspace, is too complicated a task for it to understand and do.
What I simply did, was made some changes to a file, then renamed the file (no change of folder or directory done). Next, I went into the project workspace, deleted the old file and "added" the newly named file (which is residing in the same folder and directory as the old file) into the same workspace. Then I changed the "#include" statements in the program where references to the old file name were made, so that it would now refer to the new name, and did a "Rebuild all". That's it!!!!
The rest is already known about the compiler saying it cannot open the newly named file.
I've already spent too much time on this problem, and what I'll end up doing, is simply create a new project and add in ALL the files I'll need, and resolve this issue that way.
Dev Studio needs some overhauling and I don't believe MS has any intention of doing that. In their view, "It's not broken enough."
William
Fortes in fide et opere!
|
|
|
|
|
Strange indeed. What happens if you reverse all of these changes such that the file has its old name and all references to the old file are put back in place?
Short of that, you might not even need to add the .H file to the project. For all new classes that I (not ClassWizard) create in my project, I only add the .CPP file. A #include statement with the corresponding .H file is all that's necessary.
|
|
|
|