|
|
Which function can allow me to add text in RichEdit MDI acpplications like the ReplaceSel function does?
|
|
|
|
|
I've looked through MSDN and think it's only way do do this.
Set the selection where you want to insert text (SetSel) and call ReplaceSel to insert text.
|
|
|
|
|
If you are asking specifically about Rich Text you need to use the EM_STREAMIN message with the SFF_SELECTION flag to be able to add Rich Text to the control (you can also use it to add plain text, too).
Otherwise, why are you trying to duplicate the functionality of ReplaceSel(...) ?
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
I have some code like so
void FooFunc( )
{
class Bar {
std::string name;
std::info;
};
std::vector<Bar> barVec;
}
Looks good to me, right ?
Not according to Visual C++ (VC6 sp5)!
I get this:
error C2926: 'class FooFunc::Bar' : types with no linkage cannot be used as template arguments
Grrr! Is this correct? Or is this just some missing functionality in the compiler ? If so, is it fixed in VC7?
Certainly not a critical thing just annoying
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
I did not think you could define a class within a function ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Yes you certainly can. I have done this before, just never used it in a template till today.
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
I think there's some < and > missing !
Max.
|
|
|
|
|
reply, yeah I forgot to use the gt and lt symbols in the post, I fixed it - thanks for pointing that out
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
You need to "fill" the type for the vector template, that's all:
std::vector<Bar> barVec;
|
|
|
|
|
I did - I just forgot to use the gt and lt symbols in the html post - what you have in your reply i have in my code and it still bombs out. Weird
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
You're missing a semicolon after the class definition.
Dave
|
|
|
|
|
oops, I am a sloppy poster - I fixed hte original post - in the code I had the closing semi-colon and still it gave me the error
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
This isn't supported in V6 and I even think V7.
Solutions?
Move the class outside of the function.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Looking up the error code explains the problem.
But here is something to think about: Is the reason you are getting the error code because the "template code generator/expander" will only generate code once for a given template and template-argument(s)?
Meaning, given the following code:
<br />
class CClassA<br />
{ <br />
std::vector< long > m_vecLongs;<br />
};<br />
class CClassB<br />
{ <br />
std::vector< long > m_vecMoreLongs;<br />
};<br />
-Does the "code generator" evaluatate and generate code twice, once for each std::vector< long > or does it generate the code one time, and reuse it when it sees that it has already generated the code for that specific template/template-argument before?
If the latter, it explains why the error occurs: there would be no way for the "code generator" to know if a local type called Bar is the same as another local type called Bar someplace else. With external linkage, it has the mangled name (which uses classes/structs) to identify one over the other. I do not believe that local identifiers get mangled.
Just a thought...
Peace!
-=- James (Sonork:100.21837)
"There is nothing worse than being oblivious to the fact that you do not know what you are doing."
[Get Check Favorites 1.5 Now!]
|
|
|
|
|
This is explictly banned in the standard: local classes cannot be used as template arguments (so this time it is not VC++ the one to blame).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ahh, OK thanks - good to know.
But now I can't make fun of VC6 for this anymore. Damn...
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
All members of Bar are private. Could this be the problem?
|
|
|
|
|
I am trying to print contents (as part of Print Preview ) of a TreeCtrl in my MDI application which has a CTreeCtrl member in the CFormView . I might need to print many pages(printer context). After I exceed 1 page height while printing, how do I force printing on the next page ? Also when I scroll pages all contents are lost ? why ?
What should I be doing to prevent this ?
I am basically implementing writing to the device context in my CView's OnPrint method !
Please help
|
|
|
|
|
Use CDC::EndPage() and CDC::StartPage() to the end the current page and start a new one.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Where should i be specifying these ? i tried putting StartPage in OnPrint before the function call to populate the preview and EndPage after this function ends !
|
|
|
|
|
|
I am able to print all pages of Print Preview , but I need to reset my point of printing whenever the user clicks on the Print Preview toolbars . How can I trap these events such as next page, zoom in and zoom out .
|
|
|
|
|
You don't. The CPrintInfo object passed to you should contain the page # Windows wants you to print.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello...
I'm developing under win. XP Pro, but my programs must run under win. 2k Pro, the fact is that I'm trying to resize a property sheet and under XP I've done it, I don't understand why under 2k I get the resized window not shown properly... (it gets displaced to the upper left corner...)
the code that I use is very simple:
<br />
rectPS.left = 0;<br />
rectPS.right = ::GetSystemMetrics(SM_CXSCREEN);<br />
rectPS.top = 0;<br />
rectPS.bottom = ::GetSystemMetrics(SM_CYSCREEN);<br />
<br />
this->SetWindowPos(NULL, rectPS.left, rectPS.top, rectPS.Width(), rectPS.Height(), SWP_NOZORDER | SWP_NOACTIVATE);<br />
could you explain me what is happening?
Thank you in advance
|
|
|
|