public class FileSystemRoots extends Container
Selects a filesystem root in a themed combo box. Windows exposes logical drives such as C:/; Unix exposes /, rather than listing mount points. Roots come from Path.roots() and are enumerated only during construction and an explicit refresh(). No directory is scanned.
The first available root is initially selected. The internal combo box keeps display labels separate from the typed FolderPath selection. Mouse, keyboard and programmatic changes emit selectionChanged with this component as the event source. Refreshing retains the selected root when available and emits only when the selected root actually changes.
import klyn.gui.events import klyn.gui.windows.filesystem roots = FileSystemRoots() roots.selectionChanged += lambda(e as ActionEvent): print(roots.selectedRoot) # Add roots to a window layout; call roots.refresh() after drive changes.
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | rootCountrootCount as ULong |
Number of roots in the current snapshot. |
| public property | selectedIndexselectedIndex as Long |
Selected root index, or -1 when nothing is selected. |
| public property | selectedRootselectedRoot as FolderPath |
Selected filesystem root, or null when nothing is selected. |
| Modifier and Type | Member | Description |
|---|---|---|
| public event | selectionChangedselectionChanged as ActionEvent |
Emitted once when the selected root changes, including selection clearing. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | FileSystemRootsFileSystemRoots(initialRoot as FolderPath = null) |
Creates the selector and snapshots the available filesystem roots. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | applyThemeMetrics | Sizes the component around its combo box using the active theme's control metrics, margins and container padding. |
| public | clearSelectionclearSelection() as Void |
Clears the selection without removing the available roots. |
| public override | preferredSizeIncludesContentZoompreferredSizeIncludesContentZoom() as Boolean |
Preferred dimensions already include the child control's content zoom. |
| public | refreshrefresh() as Void |
Enumerates roots again and closes the popup. |
| public | rootAtrootAt(index as Long) as FolderPath |
Returns a root without changing the selection. |
| public | selectRootselectRoot(root as FolderPath) as Boolean |
Selects an available root using normalized Path equality. |