Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Static Text gets cut off in a dialog box??

Status
Not open for further replies.

thabib

Programmer
Apr 28, 2005
3
US

i have a dialog box that has a static text that changes depending on what items are being saved or not? If i have alot of items that are going to be saved, the dialog box cuts off the rest of the items and not all the stuff being saved is listed in the dialog box. Please advice on if there is a way to fix this so the static text area resizes and doesn't get cut off at the end. thanks !
 
Im not really sure I understand you here.

Have you really thought through what you want to do? What if there is so much being saved that the static text area would need to be bigger than your dialog box?

Its hard to know how to advise you when we dont know how your code works. Are you saving items individually, and increasing the text slowly, or is the save process done once, and then the static text updated in one hit?

Either way, basically you need to set a variable indicating how much data needs to be in the text area. Then in the OnDraw() method, create a text object in the code, and relate it to the one in the collection of controls on the form. Then it should be a simple matter of setting the appropriate properties of the control before you redraw it.

Hth

K
 
Thanks for the info. I guess what I am trying to say is that I have pop-up box that asks you if you want to save things but the part where it says " Do you want to save the following items......." , the last part of the string gets cut off and you only see part of the message. I hope that helps any in my explaination.
 
Is your static text wide enough to handle that string without truncating it? That control does not auto adjust itself to the width of its string.
 
WINGS, thanks for your input. I don't think the static text is wide enough and I have been trying to resize it somehow inorder for the whole message is displayed? I can resize it by going to dialog editor and draging the control to a bigger size, but that doesn't really fix the issue, cause if I wanted to save alot of items and then when i get the dialog box stating " do you want to save (bunch of items goes here........) ? " then the last part will still get truncated. this is getting frustrating !!! anymore suggestions would be appreciated.
 
If you are using a static text control, you are going to have that problem. The control by default will auto wrap the text if it is to long, so if you increase the height of the control in the resource editor, it will wrap the text to the next line. If you cannot make the control large enough to handle all the items you want to save, you may have to use a different type of control. Maybe a rich text box or an edit box set to multi line
 
i work around this problem by using a custom control class instead of the built-in static control, which is REALLY REALLY easy to do. Whenever the custom control is resized or when its text is changed, recalculate its own size. the next WM_PAINT will fix it nice & pretty. I also send a custom window message to the parent telling it that the control's size has changed and it had better rearrange itself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top