Page MenuHomePhabricator

AWB article list horizontal scrollbar remains when list is cleared
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue

  • Load an article list with at least one name long enough to display the horizontal scrollbar
  • Clear the list (e.g. select-all, Remove)

What happens?:
The scrollbar remains. Oddly, it gets longer (reflecting a shorter "longest" article)

What should have happened instead?:
The scrollbar disappears.

Software version
AWB 6.4.0.0 and later.

Other information
The list's HorizontalExtent, which determines the scrollbar appearance, is set in the OwnerDraw method, which is called once per line every time the list (or its 16 visible items) changes. After clearing the list, there is no need to call OwnerDraw, so the HorizontalExtent keeps its earlier value.

Because ListBox and its ObjectCollection don't provide for callbacks on changes, it is difficult to determine programmatically when the box is cleared. Extending every Clear() and RemoveAt() call might do it, but is it worth the effort? And that wouldn't apply to modules/plugins. Wrapping the ObjectCollection class could be a solution, but getting that right has eluded me so far.

This comes out of an analysis in T429731.

Event Timeline

Maybe UpdateNumberOfArticles will be the right place to clear the scrollbar.

DavidBrooks claimed this task.

SVN 13036. UpdateNumberOfArticles was it.