multiline Static

I have derived a class from CStatic to set the background and foreground
colour. I want to make the text multiline. I have tried \n \n\r and variants
of in SetWindowText.

Is it even possible? Can anyone help?

-- 
Malcolm Clarke


0
not4bad (19)
4/26/2005 6:30:32 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
250 Views

Similar Articles

[PageSpeed] 43

"Malcolm Clarke" <not4bad@hotmail.com> wrote in message
news:%23ovMI4oSFHA.1152@tk2msftngp13.phx.gbl...
>
> I have derived a class from CStatic to set the background and foreground
> colour. I want to make the text multiline. I have tried \n \n\r and
variants
> of in SetWindowText.
>
> Is it even possible? Can anyone help?
>
> -- 
> Malcolm Clarke
>
>
Try "\r\n". Something like

         CWnd* ctrlBkText = GetDlgItem(IDC_MYTITLE);
        if ( ctrlBkText )
          ctrlBkText->SetWindowText( TEXT("Hello\r\nWorld") );

-- 
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------


0
CheckAbdoul
4/26/2005 7:43:38 PM
Have you tried \r\n?

----------
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6840)
4/26/2005 7:47:32 PM
not working. Just getting two SQUARE characters

I am trying

CString sText;
sText.Format("%s: %s\r\n%s - %s", sText1, sText2, sText3, sText4);

c_static_whatever.SetWindowText(sText);

Where the sText... vars as CString variables. I also tried the TEXT wrapper
but to no avail.

HELP!!!




"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
news:1114544852.625321.89230@z14g2000cwz.googlegroups.com...
> Have you tried \r\n?
>
> ----------
> Ajay Kalra
> ajaykalra@yahoo.com
>


0
not4bad (19)
4/26/2005 9:01:03 PM
In article <#ovMI4oSFHA.1152@tk2msftngp13.phx.gbl>, 
not4bad@hotmail.com says...
> 
> I have derived a class from CStatic to set the background and foreground
> colour. I want to make the text multiline. I have tried \n \n\r and variants
> of in SetWindowText.
> 
> Is it even possible? Can anyone help?

By far the easiest way to do this is with a disabled edit control 
instead of a static control -- except that you'll quickly find that a 
disabled edit control really IS a static control for most practical 
purposes, including the notification messages used. 

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
0
jcoffin (62)
4/27/2005 7:05:46 AM
Reply:

Similar Artilces:

multiline treectrl
Hello, How can I create multiline item of treectrl? Thanks MT Multiline tree ctrls can be done using custom drawing and CTreeCtrl, but are problematic if you allow the user to edit labels, and sometime scrolling is an issue. This might be a good alternative http://www.codeproject.com/treectrl/StaticTreeControl.asp AliR. "mt" <marto@vp.pl> wrote in message news:dqp3t6$ef0$1@nemesis.news.tpi.pl... > Hello, > How can I create multiline item of treectrl? > Thanks > MT Do you mean multiple selections: http://www.codeproject.com/treectrl/MultiSelect_DragImage.asp ...

Edit box
Hi All, I want to create a simple program which has to write in an editbox numbers from 1 to 10, each on a different line. I created an integer member variable and I use a for loop to generate the numbers, but I don't know how to display them on different lines in the editbox. Any help appreciated Regards, Nicolae Just insert "\r\n". -- Jonathan Wood SoftCircuits http://www.softcircuits.com Available for consulting: http://www.softcircuits.com/jwood/resume.htm "Nicolae Fieraru" <nospam@please.com> wrote in message news:41ec500a$1@duster.adelaide.on.ne...

Multiline tooltips
I'm handling TTN_NEEDTEXTx messages in my CMainFrame class and copying a string to the szText member of the TOOLTIPTEXTx structure depending on the resource id of the control. I'm doing this because the state for each control id can change and I want the tooltip to reflect the current state of the control. Okay, that all works fine, but how do I implement a multi-line height tooltip? I've tried using \r\n and just \n but the tooltips still are single line with a little box character in place of the carriage return or line feed. Anyone know how to do multi-line tooltips and if s...

Static MFC build for x64 broken with CWnd::ScreenToClient?
Hello everyone, I am using VC6 and the latest PlatSDK (W2K3 Server SP1 as of 05/02/2005) to build a statically linked MFC app for AMD64 (aka Windows x64). As soon as I add a call to CWnd::ScreenToClient, the linker complains in the release build about multiply defined symbols for CWnd::ScreenToClient, one defined in nafxcw.lib/uafxcw.lib and the other in the source file where CWnd::ScreenToClient is called. My guess is, that it is both in the library and also included via the afxwin2.inl file. Does anyone know a workaround for this issue (other than to avoid calling CWnd::ScreenToClient an...

CEdit multiline
I read the contents of a file and store them in a CStringArray with each element of the CStringArray containing one line of text. then I use the following routine to display the file contents into a multiline CEdit control, however it display only one line of text Any suggestions will be appreciated. int nLines = m_strFileDataArray.GetUpperBound();; CString temp, temp1; temp.Empty(); for (int i = 0; i != nLines; i++) { temp += m_strFileDataArray[i]; temp = "\r\n"; } m_EditWnd.SetWindowText(temp); /r/n should give a line break. You need to make sure that your control ...

Displaying rich static text
Hi, What would be the simplest thing I could do to display static text (rich) in a dialog? Looks like a simple static control would not support this.Do I have to use a CRichEditCtrl? TIA, JY >What would be the simplest thing I could do to display static text (rich) in >a dialog? Looks like a simple static control would not support this.Do I have >to use a CRichEditCtrl? For anything more than a single font you will require either a rich edit or HTML control (the former is probably the simplest solution here). Dave As pointed out, you have to use a rich edit ...

static library
How to I start a static library in VC++ 2005? I seem to saw it has a Librarian instead of Linker inside property once project is created. is that static library project cannot contain main.cpp? On Wed, 26 Mar 2008 07:40:26 -0800, Eric Kaplan <tobycraftse@yahoo.com> wrote: > How to I start a static library in VC++ 2005? > >I seem to saw it has a Librarian instead of Linker inside property >once project is created. Eric Kaplan wrote: > How to I start a static library in VC++ 2005? > > I seem to saw it has a Librarian instead of Linker inside property > once...

Re: Resources in a static library
Torsten Hensel wrote: > Hi! > > I've created a static library that contains a dialog class. The dialog is > created using the dialog editor, so it's described in a resource file. > However, static libraries cannot contain resources. You are wrong. Static libraries can very well contain resources. It's just the resource editor that cannot cope easily with distributed resource IDs. > So the application using > the lib needs to include the resources. When I add a resource include I must > include the resource.h, but this may lead to resource ID clashe...

paste multiline text to a single cell-Excel 97
I wrote a little macro to do this with the .GetFromClipboard method and it works fine, but many users will need to do this in the org and I'm wondering if there's a simpler method. Based on other recommendations I tried the replace Alt+0010 method and got an error message that the 'Formula is too long.' Is there a simpler method? Thanks! Cindy Maybe they could just paste into the formula bar. But I don't think I understand the real question. cgbikes wrote: > > I wrote a little macro to do this with the .GetFromClipboard method and it > works fine, but man...

Making a column static
Is there a way to make a column static, so it's always displayed? I have a spreadsheet that I've created hyperlinks in column A, which take you to various sections of the worksheet. I then have the header row frozen. Unfortunately when I scroll down, my hyperlinks in column a disappear. I need them to be visible at all times. Any suggestions? Unfortunately I'm still using Excel 97. Thanks. Todd With Office200 it's windows SPlit with 97 I think it was Windows FreezePanes Regards Peter >-----Original Message----- >Is there a way to make a column static, so...

multiline appointments
I synchronize my outlook calendar with my Palm device. On the Palm I can easily create appointments with multiple lines which show up correctly in various views. These appointments show up with multiple lines after synching to Outlook if I double click on an appointment to bring up the appointment form. But the form shows a maximum of 2 lines at a time. The only way to create a line break in Outlook seems to be to copy the line break from an appointment I created on the Palm and paste it into the Outlook appointment form. However, when trying to print a list of appointments, I can eith...

Increase the Font of a Static Controls in DialogBox Controls
hi all, i want to Increase the Font of the Labels before all the Controls. is there any approach to increase the Font of a Static Control that we palce before all the Controls to Identify. i want to increase the Font Size of the Static Controls before the placed before the Controls in a Dialog Box. please let me know, uday. CFont * f = c_Whatever.GetFont(); ASSERT(f != NULL); LOGFONT lf; f->GetLogFont(&lf); lf.lfHeight *= 2; // for example, this doubles the font height newfont.CreateFontIndirect(&lf); c_Whatever.SetFont(&newfont); the newfont variable should be a member...

multiline Static
I have derived a class from CStatic to set the background and foreground colour. I want to make the text multiline. I have tried \n \n\r and variants of in SetWindowText. Is it even possible? Can anyone help? -- Malcolm Clarke "Malcolm Clarke" <not4bad@hotmail.com> wrote in message news:%23ovMI4oSFHA.1152@tk2msftngp13.phx.gbl... > > I have derived a class from CStatic to set the background and foreground > colour. I want to make the text multiline. I have tried \n \n\r and variants > of in SetWindowText. > > Is it even possible? Can anyone help? > &...

Complex problem ( "STATIC" class mystery)
Hi, I am developing an application which involves creating a window's child window in another processes. 1. I created a window 'A' in process 'X' 2. I created child window of 'A', named 'B' in process 'Y' 3. I created a child window of 'B', named 'C' in process 'Z'. Everything works fine.. But when the class of window 'C' is "STATIC", clicking on window 'C' causes all the three processes appear hang !! The problem gets solved if I maximize any other window like "explorer" and minimize...

multiLine listbox
Hello all I program win32 api in C and I need a multiline listbox, could anyone please tell me how I can accomplish that or refer me to some sample application. Thank you in advance So far as I know all list boxes can hold multiple lines :o) If you mean multiple lines per item then you may need something like: http://www.codeguru.com/Cpp/controls/controls/lists,treesandcombos/article.php/c2291/ Or you could use a list control like: http://www.codeguru.com/Cpp/controls/listview/article.php/c1001/ Tom "Frank" <hero_2030@hotmail.com> wrote in message news:sP6dnVMmG...

Extracting data from multiline Spreadsheet
I have a couple of spreadsheets that use multiple lines for each record. Sample follows: Name Address City State Zip Contact John Citizen 111 Some Streeet Boston MA 00000 jcit@email.com 555-123-4567h 555-987-6543c Jane Doe 222 Another Street Boston MA 00000 555-555-6666h ...

Multiline and DrawText
I want to draw images and text on CScrollView. When I draw text,how do I draw multiline text?I use DrawText,but it draw a line only. pDC->DrawText(pszText, -1, rect, DT_NOPREFIX | DT_NOCLIP); Is your Rect big enough vertically to display multiple lines? Is the text longer than the width in your rect? You use DT_CALCRECT to figure out how big your height should be. If you set the width of the rect to how wide you want the text to be drawn, and then call DrawText with the DT_CALCRECT flag it will adjust the height of the rect to display the entire text, without drawing the te...

text in a multiline textbox...
I want to create a string and then pass it into a multiline textbox. In the the string, I will be using \r\n for a newline. I was wondering if there is any way to change part of the string to bold using parameters similar to '\r\n'? Thanks, RABMissouri2006 "RAB" <rabmissouri@yahoo.com> wrote in message news:1155528402.843382.14950@p79g2000cwp.googlegroups.com... >I want to create a string and then pass it into a multiline textbox. > In the the string, I will be using \r\n for a newline. I was wondering > if there is any way to change part of the string ...

Calculating 0 value from static value
Hi, I am not sure if this is an Access question or a SQL question. I have written an Access-front end database (2003) with a SQL back-end. I need to calulate vacatation/personal balances, however, since its the first of the year all employees receive 16 hours of personal time. They have yet to take the personal time so I am trying to calculate 16 - 0 = 16. Please keep in mind that this query does several functions by date: Here is my query: SELECT A.EMPLID, A.NAME, H.DESCR AS DEPTNAME, C.COMPANY, C.HOURLY_RT, dbo.[2009_Vac_Balances12-23].Total_Vac_Earned, ...

Multiline Quote
I am trying to print a quote with multiple line items onto a word template via Word Mail Merge and have all the line items appear on 1 sheet or record. I am using CRM 3.0 and using the print quote for customer feature. I have my template setup, it is type directory, I have used the Alt + F9 to see the hidden code and its all there but it prints each line item as a seperate quote. I see {mergeseq} but that doesnt help me unless someone describes how I can use that to help resolve this. I am not looking to purchase a 3rd party add on unless there is no other resolution. Thanks in advance fo...

static method behaviour
Folks, When using a static method: Does the constructor for the class get called? Is an object of the class instantiated nonetheless somewhere/somehow? I figure the answer to at least the last question is 'no'. I would like to hear what those that actually know about things static have to say. Be well all. A static method implies that an instance of a class is never created for that call; constructors are called when a class is instanciated. Therefore no. Imagine static class members as (in the simplest case) a seperate namespace. -- - Mark Randall http://zetech.s...

Cedit multiline problem
i have a CEDIT control, and multiline is enabled. The problem i have is with a client, all CRLF are displayed as 2 stripes. I can't simulate it. his configurations are: winxp professional service pack 1 font Trebuchet MS 11 Bold does anyone know what the problem could be?? i have tried running my app on more than one xp box, and tried some fonts, but i never have this problem. Maybe there is a known problem with xp ? i don't know thx in advance Does it happen for even something as simple as this? DWORD style = WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT | ES_MULTILINE; edit.C...

CListCtrl multiline cells
I have CListCtrl type report. I need to write into it's items multiline text. When I insert into text "\r\n", it does not help. How to write multiline text into CListCtrl cell ? Other thing what I need is to change font in some cells. I know SetFont(), but how can I retrieve HWND of cell ? Thanks ! Peter You have to create an owner draw control that does that. The only problem with that is that all your rows have to have the same height which could cause problems Here is an example of how to do it: (not so good but at least is a starting point) http://www.codeproject.com/lis...

Multiline tooltips #2
hi, Is it possible to have multiline tooltips ? thanks, Behzad "behzad Nazari" <behzadvc@yahoo.com> wrote in message news:%23BUIWwptDHA.3468@TK2MSFTNGP11.phx.gbl... > hi, > Is it possible to have multiline tooltips ? > > thanks, > Behzad > > Yes it is. I am not sure as the version specifics, however Baloon tooltips can accomplish this (and iirc so can normal tooltips). Check the MSDN documentation on the CreateToolTipEx function (this may or may not be the correct function, but it is sure to find you the correct one). "behzad Nazari" ...

Multiline Edit Control
Dear All, Need Help......... How to restrict Maximum number of Column and Number Of Row in Multiline Edit Control if Number of Charecter in a row Exceed 255 then move to next line But also validate that Line should no exceed 10 But Cursor Position should at the same line and charecter If any Idea then plz Let me know. Lalit You MAY be able to do it by using a fixed font, calculating the size of the edit box needed to contain rows x cols, setting the size of the edit box to this and then using SetLimitText. You have to be pretty careful with this sort of thing as when running on ...