|
Thanks.
I will look at adding a static control.
Kuphryn
|
|
|
|
|
I don't know how you can do it in a CEditView. In a CRichEditView you need to process the EN_LINK message.
Best regards,
Alexandru Savescu
|
|
|
|
|
|
Hi,
I'm looking for the online tutorial and sample code about how to implement threading through unix pipe facility instead of pThread. (in C++ or C programming)
Does anyone know where i can find a good resource in these areas? Does anyone know what is pipe and how to use it???
Thanks!!!
|
|
|
|
|
|
|
From MoveWindow Help:
For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.
|
|
|
|
|
I want to have an assignment operator in a class that I have several classes derived from. I want to be able to call the assignment operator using an object defined as a pointer to the base class but have it execute the code in the proper derived class.
I don't know if I explained it very well so here's a little bit of code:
CElement* pTempElement;
pTempElement = pElement;
where pElement is a pointer to a class that was derived from the CElement base class.
My goal is to be able to get the data from pElement to pTempElement but not share the memory address. If there's an easier way than I'm working on, that's fine too. Probably a stupid question but I've always had a bit of a mental block when it comes to pointers.
|
|
|
|
|
Override new operator instead?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
You need to dereference the objects;
CElement* pTempElement;
*pTempElement = *pElement;
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Using operator= is not a good idea, since the version for the base class will be used instead of that of the actual type pointed to by pElement . The standard idiom to handle this situation (which is fairly common) is to define a virtual function clone just like this:
class CElement
{
...
virtual CElement* clone()=0;
}; Then in every derived class you just write:
class CDerivedElement
{
...
virtual CElement* clone()
{
return new CDerivedElement(*this);
}
} so that your program can copy objects like this:
CElement* pTempElement;
pTempElement=pElement->clone(); Remember to declare ~CElement as virtual. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a MDI application that the CRichEditView (from which I can get the CRichEditCtrl object). How do I insert lines of text programmatically? And can I do it line by line?
tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Nevermind, I found out. CRichEditCtrl::StreamIn
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
furthermore to your question, how do I specify format (bold, italic, font, size, color, etc ...) of text I add by program ?
DD
|
|
|
|
|
hey, i have a hook procedure which catches the creation of menu windows... but it only works sometimes and for some menus
for example, the right-click menu in the caption bar always gets caught, and the top menus sometimes get caught
is there a way to catch the creation of ALL menus, like an example or something?
thanks
- Roman -
|
|
|
|
|
I want my application to start without creating an empty new document, but I still want it to load a document if specified on the command line. I remember that it is something in the CWinApp::InitInstance, but can't remember what.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
|
|
|
|
|
It does not work because if a file is specified on the command line, it sets to FileNothing anyway. But you put me on the track. I did the following:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) ? CCommandLineInfo::FileNothing : cmdInfo.m_nShellCommand;
Tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Im using a CEdit to display a bunch of text.. is there a way to set the font so that it is fixed width? like this website, how all of the text lines up in set spacing no matter how thin or thick each character's width is..
i've tried:
BOOL CTextViewer::OnInitDialog()
{
SetWindowText(m_strTitle);
CDialog::OnInitDialog();
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
CFont font;
font.CreatePointFont(120,"FixedSys",NULL);
pEdit->SetFont(&font, TRUE);
return TRUE;
}
this seems to make the text bold, and it looks really strange when highlighting, but its not fixed width.. im having similar problems when printing as well..
ive tried using the print class from CP A Simple Printing Mechanism which is supposed to print lines in fixed width, but that doesn't work for me.. anyone see whats wrong with it?
BOOL CPrinter::StartPrinting()
{
DOCINFO info;
::ZeroMemory(&info, sizeof(info));
info.lpszDocName = AfxGetAppName();
SetPrinterFont();
dc->StartDoc(&info);
docStarted = TRUE;
TEXTMETRIC tm;
dc->GetTextMetrics(&tm);
lineHeight = tm.tmHeight + tm.tmInternalLeading;
pageVMargin = dc->GetDeviceCaps(LOGPIXELSY) / 2;
pageHMargin = dc->GetDeviceCaps(LOGPIXELSX) / 2;
pageHeight = dc->GetDeviceCaps(VERTRES);
pageWidth = dc->GetDeviceCaps(HORZRES);
Y = pageVMargin;
return TRUE;
}
void CPrinter::SetPrinterFont()
{
CFont f;
f.CreateStockObject(ANSI_FIXED_FONT);
dc->SelectObject(&f);
}
basicly i am trying to write a little dialog which shows text and prints the text in fixed width fonts.. any one tried the other simple print classes on here for fixed width?
thanks!
-dz
|
|
|
|
|
try using the standard fixed-width font: Courier New . it's easier on the eyes and easier to program than trying to force a proportionally-spaced font into evenly-spaced locations.
-c
30% of your base are belong to the IRS!
|
|
|
|
|
ive tried putting different font names into the font.CreatePointFont(120,"Impact",NULL); command, and i've tried passing CEdit->GetDC() instead of NULL, but the font always looks the same, and is not fixed width..
notepad uses fixed width inside of what I assume is a CEdit control, and it prints with fixed width.. i must be doing something wrong, or explaining myself wrong..
thanks!
-dz
|
|
|
|
|
Courier New is a fixed width font... unless you're using it wrong, there's no way for it not to be fixed width... post a screenshot and we'll help you from there
- Roman -
|
|
|
|
|
screen shot
and here is the code that i have currently..
BOOL CTextViewer::OnInitDialog()
{
SetWindowText(m_strTitle);
CDialog::OnInitDialog();
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
CFont font;
font.CreatePointFont(120,"Courier New",NULL);
pEdit->SetFont(&font, TRUE);
return TRUE;
}
i guess maybe i should take the time to look into CEditView (i guess thats whats in notepad).. but im still kinda confused on how to popup a window with a view in it..
-dz
|
|
|
|
|
I'm trying to debug the commandline in an MFC application. I want to load a file with a file assocation to my program. This program will then load the file to open. Just like double clicking a .txt file and opening up in notepad. Any ideas,
Thanks
|
|
|
|
|
I'm not sure what you mean, but you've got commandline support for free in a SDI or MDI MFC project (check the corresponding InitInstance .) Maybe you can start from there.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|