Rapid-Q Documentation by William Yu (c)1999-2000 | Appendix A: QFILELISTBOX

# QFILELISTBOX Component

  Use QFileListBox when you want to maintain a listbox with all the files in a specific directory. It can also list directories as well.
  QFileListBox Properties

  Field | Type | R/W | Default

  Align | INTEGER | RW | alNone
  | Align determines how the control aligns within its parent control.
  Color | INTEGER | RW |
  Cursor | INTEGER | RW | crDefault
  Directory | STRING | RW |
  | Directory is the directory that contains all the files listed in the file listbox.
  Drive | STRING | RW |
  Enabled | INTEGER | RW | True
  ExtendedSelect | INTEGER | RW | True
  | ExtendedSelect determines if the user can select a sequential range of items in the file listbox.
  Filename | STRING | RW |
  | FileName is the name of the selected file in the listbox, including the pathname.
  Font | QFONT | W |
  Height | INTEGER | RW |
  Hint | STRING | RW |
  Item | ARRAY of STRING | RW |
  ItemCount | INTEGER | R |
  ItemHeight | INTEGER | RW |
  ItemIndex | INTEGER | RW |
  | ItemIndex specifies the index of the selected item in the file listbox. If no item is selected, ItemIndex equals -1.
  Left | INTEGER | RW | 0
  Mask | STRING | RW | *.*
  MultiSelect | INTEGER | RW | False
  Parent | QFORM/QPANEL/QTABCONTROL | W |
  PopupMenu | QPOPUPMENU | W |
  SelCount | INTEGER | R |
  Selected | ARRAY of INTEGER | RW |
  ShowHint | INTEGER | RW | False
  ShowIcons | INTEGER | RW | False
  | ShowIcons determines whether images should appear next to the file names.
  TabOrder | INTEGER | RW |
  Tag | INTEGER | RW |
  TopIndex | INTEGER | RW |
  | TopIndex specifies the index number of the item that appears at the top of the file listbox.
  Top | INTEGER | RW | 0
  Width | INTEGER | RW |
  Visible | INTEGER | RW | True

  QFileListBox Methods

  Method | Type | Description | Params

  AddFileTypes | SUBI | Add certain file types to list box | INTEGER, Infinite
  | FileTypes determine which files are displayed in the file listbox according to their attributes. 0 = ftReadOnly -- Display files with read-only attribute. 1 = ftHidden -- Display files with hidden attribute. 2 = ftSystem -- Displays system files.
  3 = ftVolumeID -- Displays volume name.
  4 = ftDirectory -- Displays directories.
  5 = ftArchive -- Display files with archive attribute.
  6 = ftNormal -- Display files with no special attributes.
  Example:

  > $INCLUDE "RAPIDQ.INC"
  > DIM FileListBox AS QFILELISTBOX
  > FileListBox.AddFileTypes(ftDirectory, ftHidden)

  DelFileTypes | SUBI | Remove certain file types from list | INTEGER, Infinite
  Update | SUB | Updates/refreshes file list | 0

  QFileListBox Events

  Event | Type | Occurs when... | Params

  OnChange | VOID | Directory changes | 0
  OnClick | VOID | File was clicked on | 0
  OnDblClick | VOID | Selection was double clicked on | 0

  QFileListBox Examples

      '' Simple Application Launcher
      '' How to use the File List Box as a Directory List Box in Rapid-Q by William Yu

      $INCLUDE "RAPIDQ.INC"

      DECLARE SUB ChangeDirectories
      DECLARE SUB ExecuteApplication
      DECLARE SUB ResizeForm

      CREATE Form AS QForm
        Height = 300
        Width = 450
        CREATE DirList AS QFileListBox     '' Can double as a Directory list box
         ShowIcons = True
         Mask = "*.*"
         AddFileTypes(ftDirectory)          '' Add Directories
         DelFileTypes(ftNormal)             '' Remove files (see RAPIDQ.INC for values)
         OnDblClick = ChangeDirectories
         Height = Form.ClientHeight
         Width = 200
        END CREATE
        CREATE EXEList AS QFileListBox
         ShowIcons = True
         Mask = "*.EXE"
         OnDblClick = ExecuteApplication
         Left = 215
         Height = Form.ClientHeight
         Width = 225
        END CREATE
        Center
        Caption = DirList.Directory
        OnResize = ResizeForm
        ShowModal
      END CREATE

      SUB ChangeDirectories
        ChDir(DirList.Item(DirList.ItemIndex) - "[" - "]")
        DirList.Directory = CurDir$:  EXEList.Directory = CurDir$
        Form.Caption = CurDir$
      END SUB

      SUB ExecuteApplication
        RUN EXEList.FileName    ' Non-Blocking
      '  SHELL EXEList.FileName  ' Blocks, until program terminates
                                 ' Becareful running 16-bit applications
      END SUB

      SUB ResizeForm
        DirList.Height = Form.ClientHeight
        EXEList.Height = Form.ClientHeight
        EXEList.Width = Form.ClientWidth - 215
      END SUB

  Prev Component | Contents | Next Component