Fog Creek Software
Discussion Board




Multi-line edit and line breaks

I'm still on this app with the colored listview (using NM_CUSTOMDRAW now, thanx) with funny characters in the multi-line edit (solved now, see previous thread)

In short, I'm down to 1 issue

Win32, multi-line edit controls, filled out with lots of text (sometimes including some long lines of text)

The text is on (surprise) multiple lines. I split the lines, using CR LF sequences, then fill in the control using SetWindowText.  Usually this works

However sometimes I get 2 little block characters in the edit (for CR and LF) rather than a line-break

I have never seen this behaviour before, I can't see any logic to it, and ideas?

S.Tanna
Thursday, February 05, 2004

Use rich text controls.  Among the many things that they do better than standard text controls, they also handle line endings better.

Oren
Thursday, February 05, 2004

Interesting suggestion, but I don't really want to go that route

I'm programming to the WIN API (i.e. low level and tedious) in a DLL which lives inside another app, so I want keep it simple as possible. Also, debugging is very hard, because I can't even run a debugger

I just need to find out what the quirk in multiline edit is.

S.Tanna
Thursday, February 05, 2004

Visual Studio can debug dll:s. However, without a debugger, another way to find bugs is to add logging to your systems to see what's going on.

Mellowman
Thursday, February 05, 2004

I already have the logging thing, and I prepare the code initially in a dummy EXE

Trust me though, Visual C can not debug this DLL/app combination.

S.Tanna
Thursday, February 05, 2004

Try a \r instead of (in addition to? I forget...) the CR-LF.

Dobie
Thursday, February 05, 2004

As far as I remember (which is questionable...), the standard edit controls recognize only CR/LF pairs, and in that order.  If you see funny characters then there's probably some deviation from this.  For example, if you have two CR's or two LF's in a row, or their order is reversed, then you might get this behavior.

Oren
Thursday, February 05, 2004

Tanna,
What the reason you can't debug it?

If it's DirectX app (or other full-screen thing) you can try remote debugging (VS/WinDbg both support this mode)

If you can't debug your program with VS2003 debuggers you can try WinDbg (http://www.microsoft.com/whdc/ddk/debugging/installx86.mspx)
Debuggers from this package can debug everything on Windows platforms.

WildTiger
Thursday, February 05, 2004

*  Recent Topics

*  Fog Creek Home