Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-15919

RichEdit control should automatically show/hide scrollbars unless ES_DISABLENOSCROLL is specified

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Untriaged
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Testcase attached.

      Bug description:

      In ReactOS the RichEdit control is showing a vertical scrollbar even if the RichEdit control is empty. This doesn't happen in Windows. 

      Possible reason of this bug:

      Right now ReactOS RichEdit control will always show Horizontal and/or Vertical scrollbars, even if the content fits the window, when WS_HSCROLL and/or WS_VSCROLL are applied.

      Applying WS_HSCROLL and WS_VSCROLL to a RichEdit control does not force in Windows to show its scrollbars always. In Windows, scrollbars in RichEdit are "intelligent" and if the content fits the Client area the scrollbars are not shown even if these WS_(H|V)SCROLL styles are applied. If you want to "force" the scrollbars to be shown always in a RichEdit control you have to add an extra style: ES_DISABLENOSCROLL.

       

      Offending code in the testcase:

      hEdit=CreateWindow("RichEdit", "", WS_CHILD | WS_VISIBLE | WS_BORDER |ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL, ....)

       

      This WS_VSCROLL seems to be enforcing in ReactOS to paint the Vertical Scrollbar always. Showing vertical scrollbar always should just happen in RichEdit when WS_VSCROLLES_DISABLENOSCROLL styles are applied together.

      RICHEDIT vs EDIT SCROLLBARS

      From the Scrollbar pov, RichEdit is behaving as its small bro Edit control. When creating an EDIT control in Windows, if you add a WS_HSCROLL or WS_VSCROLL, the scroll is always added even if the content fits the Client area. EDIT control scrollbars, let's say, are not intelligent. If you want to hide scrollbars in an EDIT control when the content fits the Client area, you are enforced to subclass the EDIT, hear for WM_SIZE and FONT messages, and react accordingly with ShowScrollBar()

       

      Reference: https://stackoverflow.com/questions/18144388/how-to-auto-hide-scrollbars-on-edit-control (Remy Lebeau answer)

       

      Bonus: Probably this explains the reason why in the Font Settings dialogs (where several controls lets you select the Font, its Size, its Weight, etc) micro-scrollbars totally unneeded are always painted (probably because these controls are RichEdit controls).

       

      ccing jimtabor 

       

       

       

       

        Attachments

        1. coolbar.exe
          33 kB
        2. coolbar2.zip
          45 kB
        3. Fixed Font Dialog.png
          Fixed Font Dialog.png
          45 kB
        4. image-2019-04-04-02-35-43-357.png
          image-2019-04-04-02-35-43-357.png
          456 kB
        5. main.cpp
          21 kB

          Issue Links

            Activity

              People

              • Assignee:
                bug zilla Bug Zilla
                Reporter:
                vicmarcal vicmarcal
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: