Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3816

Selecting Drives

$
0
0

I am a listbox that displays the drives connected to Mac computer. I have the code so that it will check any folder and all subfolders below the main Drive level. However, I want the same action to occur when I select the main drive. I just can’t figure this out. Here is the code for the folder selections:

Var f As FolderItem = me.RowTag(row)
Var FoldersToSelect() As FolderItem

If f.Directory = True Then
  FoldersToSelect.Append(f)
End If

While FoldersToSelect.Ubound > -1
  Var j As Integer
  
  ' Find the row that has a reference to this folder in it's rowtag
  For j = row To me.ListCount - 1
    If me.RowTag(j) = FoldersToSelect(0) Then
      Exit For
    End If
  Next
  me.Expanded(j) = True
  me.CellState(j, column) = me.CellState(row, column)
  
  ' Walk forward selecting rows
  For k As Integer = j + 1 To me.ListCount
    
    If FolderItem(me.RowTag(k)).Parent.NativePath <> FolderItem(me.RowTag(j)).NativePath Then
      Exit For
    End If
    me.CellState(k, column) = me.CellState(row, column)
    
    If FolderItem(me.RowTag(k)).IsEjectableVolumeMBS Then
      Exit For
    End if
    me.CellState(k, column) = me.CellState(row, column)
    
    ' This is a subfolder so add it to the list to process
    If me.RowIsFolder(k) Then 
      FoldersToSelect.Append(me.RowTag(k))
      me.Expanded(k) = False
    End If
    
  Next
  FoldersToSelect.Remove(0)
Wend

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3816

Trending Articles