2

I have a list control in report mode and I'd like to remove the horizontal scrollbar from the list control and if the lines are too long, I'd have the remainder simply being truncated.

It's should be like using LVS_NOSCROLL but only for the horizontal scrollbar.

LVS_NOSCROLL does almost what I want but:

  • it removes also the vertical scrollbar
  • the list control's header is no longer displayed

Or in pictures:

I want this:

enter image description here

instead of this:

enter image description here

All information I've found is about the LVS_NOSCROLL style being not compatible with the LVS_LIST or LVS_REPORT, referencing a "Knowledge Base Article Q137520" which I couln'd find anywhere.

Does anybody have an idea ?

Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
  • `SetWindowLong(hList,GWL_STYLE,GetWindowLong(hList,GWL_STYLE) & ~WS_HSCROLL);` – milevyo Nov 24 '15 at 11:31
  • @milevyo That's not enough. You have to do that in response to `WM_NCCALCSIZE` as demonstrated in the dupe. – David Heffernan Nov 24 '15 at 11:37
  • @DavidHeffernan i was about to give a full answer ,when it pops up that this question is closed and do not accept any more answer. so i stoped there, but my idea was not to intercept WM_NCCALCSIZE, but to intercept WM_STYLECHANGED and WM_STYLECHANGING instead – milevyo Nov 24 '15 at 11:40
  • Add that answer to the dupe if you wish. You'd need to use `WM_STYLECHANGING` rather than `WM_STYLECHANGED`. Don't know if it would work, but it should. – David Heffernan Nov 24 '15 at 11:43
  • @milevyo FWIW though, I don't think `WM_STYLECHANGING` fires when the control changes this style. I can't see past `WM_NCCALCSIZE`. – David Heffernan Nov 24 '15 at 11:50
  • @DavidHeffernan, it does :) – milevyo Nov 24 '15 at 11:51
  • @milevyo Not for me. Anyway this is a clear dupe, and if you want to add an answer, you can do so over there. – David Heffernan Nov 24 '15 at 11:52
  • @DavidHeffernan OK, i will try to. – milevyo Nov 24 '15 at 11:53
  • @DavidHeffernan, i am surprised , you are right. it fires the style changed, but whatever you do, it won't remove the scroll bar; – milevyo Nov 24 '15 at 14:15
  • @milevyo That's not what I see. FWIW, **changed** is no good, you need **changing**. And you need to check the value of `wParam` to know whether it is the style of the extended style that is changing. When you do that, then I see lots of notifications for extended style changing, but not so much for the style. – David Heffernan Nov 24 '15 at 14:20
  • @milevyo Changed is no use here because it's notifying you after the event. Only changing allows you to influence the change. – David Heffernan Nov 24 '15 at 14:29
  • @DavidHeffernan again, you are right, it doesn't . – milevyo Nov 24 '15 at 15:01

0 Answers0