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
FieldTypeR/WDefault




AlignINTEGERRWalNone
Align determines how the control aligns within its parent control.
ColorINTEGERRW
CursorINTEGERRWcrDefault
DirectorySTRINGRW
Directory is the directory that contains all the files listed in the file listbox.  Make sure the directory exists first.
DriveSTRINGRW
EnabledINTEGERRWTrue
ExtendedSelectINTEGERRWTrue
ExtendedSelect determines if the user can select a sequential range of items in the file listbox.
FilenameSTRINGRW
FileName is the name of the selected file in the listbox, including the pathname.
FontQFONTW
HeightINTEGERRW
HintSTRINGRW
ItemARRAY of STRINGRW
ItemCountINTEGERR
ItemHeightINTEGERRW
ItemIndexINTEGERRW
ItemIndex specifies the index of the selected item in the file listbox. If no item is selected, ItemIndex equals -1.
LeftINTEGERRW0
MaskSTRINGRW*.*
MultiSelectINTEGERRWFalse
ParentQFORM/QPANEL/QTABCONTROLW
PopupMenuQPOPUPMENUW
SelCountINTEGERR
SelectedARRAY of INTEGERRW
ShowHintINTEGERRWFalse
ShowIconsINTEGERRWFalse
ShowIcons determines whether images should appear next to the file names.
TabOrderINTEGERRW
TagINTEGERRW
TopIndexINTEGERRW
TopIndex specifies the index number of the item that appears at the top of the file listbox.
TopINTEGERRW0
WidthINTEGERRW
VisibleINTEGERRWTrue


QFileListBox Methods
MethodTypeDescriptionParams




AddFileTypesSUBIAdd certain file types to list boxINTEGER, 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)
DelFileTypesSUBIRemove certain file types from listINTEGER, Infinite
UpdateSUBUpdates/refreshes file list0

QFileListBox Events
EventTypeOccurs when...Params




OnChangeVOIDDirectory changes0
OnClickVOIDFile was clicked on0
OnDblClickVOIDSelection was double clicked on0


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