Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 100
iSeries FTP Exit Program 8 114
ffmpeg - "rtsp://...... Operation not permitted" 4 68
twoTwo  challenge 35 86
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now