[Scummvm-tracker] [ScummVM :: Bugs] #14551: GUI: Search box lose focus in grid launcher when typing text

ScummVM :: Bugs trac at scummvm.org
Fri Sep 1 23:50:05 UTC 2023


#14551: GUI: Search box lose focus in grid launcher when typing text
-------------------+---------------------
Reporter:  criezy  |       Owner:  (none)
    Type:  defect  |      Status:  new
Priority:  normal  |   Component:  GUI
 Version:          |  Resolution:
Keywords:          |        Game:
-------------------+---------------------
Comment (by PushmePullyu):

 The assert should be fixed with commit
 !4867e14d604a2556f77a036d9e5eff0477bd26b8. Since you mentioned that you
 made no selection, the mouse was probably moving when the LMB was released
 after clicking the search box. This is interpreted as dragging the mouse
 to make a selection and sets _selCaretPos (see bug #14584).

 The loss of focus seems to be caused by these events:

 Typing in the search box leads to a call to GridWidget::setFilter(), which
 does the following:

 {{{
 _scrollPos = 0;
 ...
 sortGroups();
 }}}


 In sortGroups():

 {{{
 _scrollBar->checkBounds(_scrollBar->_currentPos);
 }}}


 When the filter removes grid entries, _scrollBar->_currentPos can now be
 larger than the position of the last entry, and so checkBounds() resets it
 and sends a kSetPositionCmd. This is more likely to happen if _currentPos
 is large, i.e. the view is scrolled further towards the end.

 As antoniou79 stated, the command then causes GridWidget::handleCommand()
 to set focus to the grid widget.

 Since setFilter() already sets _scrollPos to 0 this could be fixed by
 propagating the change to _scrollBar->_currentPos before calling
 checkBounds().
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/14551#comment:6>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list