Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I put an edit box on a dialog box in VS2008 and set it's multiline to true so I could paste a base64 encoded serial number in. The copy source was a notepad .txt file and looks like this:

gisG+B76G6+NLubeCwJBzHF+gqc0inH7Yth4GaBU72BD31DrQl7KR70VaMngvmcOX92e2i
L+52b2EXJtMT4NsKLjBTQzEbRz6s4oz+PtE40uO5Iinlhyyliwf0oTDY807YTK9ZbXb5yZ
pfLFWRBGmZC0W12zvoTNmkG8fxt785J+xZbxZeMjaWwJvww4BOo79UaRQdcmCKhIY8IIrj
iqhhbXPhFen1kyyALFwuo0x/rgjYtJMaha4zHHY1QVoEBM101mSHKizY2S9pM9onyas7It
Ki6lA5mFJcTGPQP3+LZreYDsdDTQ4DpeMGEF5ypBCAM9lQIjTU/Xpy19zqCw0A==

It looks like this in the edit box when pasted:

gisG+B76G6+NLubeCwJBzHF
+gqc0inH7Yth4GaBU72BD31DrQl7KR70VaMngvmcOX92e2i
L+52b2EXJtMT4NsKLjBTQzEbRz6s4oz+PtE40uO5Iinlhyyliwf0oTDY807YTK9ZbXb5yZ
pfLFWRBGmZC0W12zvoTNmkG8fxt785J
+xZbxZeMjaWwJvww4BOo79UaRQdcmCKhIY8IIrj
iqhhbXPhFen1kyyALFwuo0x/rgjYtJMaha4zHHY1QVoEBM101mSHKizY2S9pM9onyas7I
t
Ki6lA5mFJcTGPQP3+LZreYDsdDTQ4DpeMGEF5ypBCAM9lQIjTU/Xpy19zqCw0A==

What must I do?

No only is it ugly, is is parsed as invalid.
Curiously, if I copy the ugly text and paste it here it looks fine.

:Ron
Posted
Comments
CHill60 16-Nov-13 17:43pm    
Looks like some sort of weird wordbreak functionality is affecting it - still doesn't quite explain it though

1 solution

I notice that of the 5 lines you've pasted, only 2 of them have been un-broken - the second and the last. These are also the shortest two lines.
I just made a dialog app with a single multi-line edit, pasting your data into it - it's fine and looks like your original. (it was wider than the text). I then narrowed it considerably, hoping to get the same output - nope, no luck. The whole string is no longer visible, but there are still only 5 lines of text.

About then I realized that my edit-box has just two styles attached. ES_MULTILINE and more particularly ES_AUTOHSCROLL. ES_MULTILINE will wrap if the text is too wide for the box or if it contains line-breaks. ES_AUTOHSCROLL on the other hand, allows text to run longer than the control.

Here's the resource-code for the dialog I used to test it with:
CSS
//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
DLG_MAIN DIALOG 0, 0, 343, 151
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "Ms Shell Dlg"
{
    EDITTEXT        IDC_EDIT1, 7, 7, 264, 96, ES_AUTOHSCROLL | ES_MULTILINE   // OK
//    EDITTEXT        IDC_EDIT1, 7, 7, 300, 96, ES_AUTOHSCROLL | ES_MULTILINE   // OK
//    EDITTEXT        IDC_EDIT1, 7, 7, 264, 96, ES_MULTILINE   // FAIL - too narrow, wraps
}


If I then remove the ES_AUTOHSCROLL from the narrower edit box, I then get the following:
VB
gisG+B76G6+NLubeCwJBzHF
+gqc0inH7Yth4GaBU72BD31DrQl7KR70VaMngvmcOX92e2i
L+52b2EXJtMT4NsKLjBTQzEbRz6s4oz
+PtE40uO5Iinlhyyliwf0oTDY807YTK9ZbXb5yZ
pfLFWRBGmZC0W12zvoTNmkG8fxt785J
+xZbxZeMjaWwJvww4BOo79UaRQdcmCKhIY8IIrj
iqhhbXPhFen1kyyALFwuo0x/rgjYtJMaha4zHHY1QVoEBM101mSHKizY2S9pM9o
nyas7It
Ki6lA5mFJcTGPQP3+LZreYDsdDTQ4DpeMGEF5ypBCAM9lQIjTU/Xpy19zqCw0A
==
 
Share this answer
 
Comments
Ron Anders 17-Nov-13 16:03pm    
Most excellent enhzflep,

That fixed it!
Now it pastes good, is good.

Thank you!
enhzflep 17-Nov-13 22:24pm    
A pleasure Ron, you're welcome. :)
Simon.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900