[Gambas-bugtracker] Bug #1341: Selection Changes When FileChooser/FileView Refreshed

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Wed Jun 13 19:02:01 CEST 2018


http://gambaswiki.org/bugtracker/edit?object=BUG.1341&from=L21haW4-

Comment #1 by Tony MOREHEN:

Detailed view uses a columnview to show the file list.  Columnview inherits _TreeView.  When _TreeView is refreshed, a delayed row sort is triggered by a timer calling
Sort_Timer.  This sort messes up the file selection.  Note Sort_Timer contains code to correctly reset selection when Mode is set to Single.  Replacing that code with the more general _SaveSelection and _RestoreSelection seems to fix the bug without any side effects.  The revised code:

Public Sub Sort_Timer()
  
  ' Dim hItem As _TreeView_ItemX
  
  $hSortTimer = Null
  If Not $cSort Then Return
  
  _SaveSelection
  ' hItem = Current_Read()
  
  For Each $cSort
    SortItem($cItem[$cSort.Key])
  Next
  If $bSortRoot Then
    SortItem($hRoot)
  Endif
  $bSortRoot = False
  $cSort.Clear
  
  _RestoreSelection
  ' If hItem Then _SetItemSelected(hItem, True)
  
End




More information about the Bugtracker mailing list