Solved

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

Posted on 2003-11-05
5
180 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

734 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