-1

I use a CEdit text field to input a search term in an MFC application. When using it on FullHD resolution it works fine, I can input as long as big of a string as i need, but when using on 4k resolution the text is limited to 10 characters. The return of GetLimitText is 3000, and if I SetLimitText to a value smaller than 10 it works, limiting to more (such as 20) doesn't do anything, only 10 characters can be input still. Has anyone had this problem before or it might be from my implementation?

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
user3808318
  • 827
  • 1
  • 8
  • 15

2 Answers2

0

I "fixed" it in a way. I was calling CWnd::ModifyStyleEx(0, WS_EX_CLIENTEDGE). I replaced with CWnd::ModifyStyle(0, WS_BORDER). This is not a true fix as it changes the way it looks a bit, but I guess this is a bug.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
user3808318
  • 827
  • 1
  • 8
  • 15
0

I ran into a similar problem when creating the equivalent of resources for a CDialogBar on-the-fly (instead of using the resource editor). One of the controls was a CEdit control, and as user3808318 pointed out, MFC or Windows mysteriously ignores any value you assign using SetLimitText, and seems to ignore any characters you type that would extend beyond the edit control on the screen.

This is the original way that I created the edit control that resulted in this problem.

Create (WS_CHILD | WS_VISIBLE | WS_BORDER, rectDummy, this, IDC_FIND_TEXT)

Here is the correct way, now including the ES_AUTOHSCROLL option.

Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, rectDummy, this, IDC_FIND_TEXT)

MalcolmX
  • 1
  • 1
  • I tried adding ES_AUTOHSCROLL as well, it didn't fix my issue unfortunately. Also i found out the problem only occured using 4k Resolution or 150% scaling on 1080. – user3808318 Sep 13 '20 at 19:39