Solved

How do I put a chunk of text on the dialogue window?

Posted on 2003-11-05
5
176 Views
Last Modified: 2013-11-20
I need to write a list of instructions in the dialogue to tell the user what to do.
I tried to use the Static Text control and put what I want to write in the Caption box;
however, there is a limit of how many characters I can put in it, which is 255.
Can anybody tell me what should I do? I am pretty sure what is a way but I just haven't
been able to find out how.

Thanks!
0
Comment
Question by:UltimateApocalypse
5 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9692591
Number of characters in Static control is not limited. Please show your code, possibly you have some error.
0
 
LVL 3

Accepted Solution

by:
komar earned 50 total points
ID: 9692997
Try showing the instructions at run time. This can be done by adding the following code to your OnInitDialog() member of the dialog object.

CString strInstructions = _T("1. Instruction1\r\n")
                                    _T("2. Instruction2\r\n")
                                    _T("3. Instruction3\r\n");

CStatic *p = (CStatic *)GetDlgItem(IDC_MY_STATIC);
p->SetWindowText(strInstructions);

/*In this code, I assumed that the ID of the Static control in the dialog resource is IDC_MY_STATIC */
0
 

Expert Comment

by:Sekhar_ee
ID: 9693377
Yes  What AlexFM told is correct. There is no limit in the number of characters.

I tried the same sample that was given by you... I am able to show more than 1000 charcaters in the static text.
Probably the size of your static text is very less so that it is unable to display all the characters.

0
 
LVL 1

Expert Comment

by:ragin_cajun
ID: 9695274
Hi,

perhaps the static text control limit has changed - my Practical Visual C++ book says static text controls have a limit of 255 characters. Anyways, I've had the same problem, and what I've had to do in the past is group multiple controls together to output a chunk of text.

OR if you feel comfortable doing it - you can handle the WM_PAINT message, and in there obtain a device context of your window and output as much text as you want using TextOut() or DrawText() - this is more complicated but definitely possible. It will work. If you want some more info plz post.
0
 

Author Comment

by:UltimateApocalypse
ID: 9698722
Thanks!!
I was trying to input the instructions directly in the Caption edit box, I guess that's probably why it did not work.
Maybe it isn't the correct way of using the Static Text Control.
Anyway, komar's solution is very convenient and easy to use.
Thanks again!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 93
Expand LInux Boot partition remotly 3 91
MaxSpan challenge 9 96
JQuery serialize and unserialize 8 87
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question