Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-05
5
Medium Priority
?
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

604 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