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


QLISTBOX Component

QListbox implements a generic (veritcal scrolling) Windows listbox. The first item in any listbox is 0, the next is 1, and so on...

QListbox Properties
FieldTypeR/WDefaultSupport





AlignINTEGERRWalNoneW

Align determines how the control aligns within its parent control.
BorderStyleINTEGERRWbsSingleW
ColorINTEGERRW
WX
ColumnsINTEGERRW0W

Columns specifies the number of columns, in a multi-column listbox, that are visible without having to scroll. You can only select an entire row
CopyModeINTEGERRWcmBlacknessW
CursorINTEGERRWcrDefaultW
EnabledINTEGERRWTrueWXG
ExtendedSelectINTEGERRWTrueWX

ExtendedSelect determines if the user can select a sequential range of items in the listbox.
FontQFONTW
W
HandleINTEGER    for windows API callsR
W
HeightINTEGERRW
WXG
HintSTRINGRW
WXG
ItemARRAY of STRINGRW
WXG

Item contains the strings that appear in the listbox.
ItemCountINTEGERR
WXG
ItemHeightINTEGERRW
W
ItemIndexINTEGERRW
WXG
LeftINTEGERRW0WXG
MultiSelectINTEGERRWFalseWX
ParentQFORM/QPANEL/QTABCONTROLW
WXG
PopupMenuQPOPUPMENUW
W
SelCountINTEGERR
W
SelectedARRAY of INTEGERRW
WX
ShowHintINTEGERRWFalseWXG
SortedINTEGERRWFalseWG

Sorted specifies whether the items in a listbox are arranged alphabetically.
StyleINTEGERRWlbStandardW

Style determines whether the listbox is standard or owner-draw.
0 = lbStandard -- All items are strings, with each item the same height.
1 = lbOwnerDrawFixed -- Each item in the listbox is the height specified by the ItemHeight property.
2 = lbOwnerDrawVariable -- Items in the listbox can be of varying heights.
TabOrderINTEGERRW
W
TabWidthINTEGERRW0W
TagINTEGERRW
WXG
TextSTRINGRW
W

Text defines the items in the listbox as CRLF terminated strings.
TopINTEGERRW0WXG
TopIndexINTEGERRW
W
VisibleINTEGERRWTrueWXG
WidthINTEGERRW
WXG

QListbox Methods
MethodTypeDescriptionParamsSupport





AddItemsSUBIAdd items to listboxSTRINGs, InfiniteWXG
CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Draw & Fill Circle6W
ClearSUBClears entire listbox0WXG
CopyRectSUB (D, Image, S)D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap3W
DelItemsSUBIDelete items by their indexIndex #s, InfiniteWXG
DrawSUB (x%, y%, BMP)Draw Bitmap at (X,Y)3W
FillRectSUB (x1%, y1%, x2%, y2%, c%)Draws & Fills a rectangle5W
InsertItemSUB (Index%, String$)Insert item at Index%2WXG
LineSUB (x1%, y1%, x2%, y2%, c%)Draws a line5W
LoadFromFileSUB (FileName AS STRING)Load file to list1W
PaintSUB (x%, y%, c%, borderc%)Fill Region4W
PsetSUB (x%, y%, c%)Pixel plot3W
RectangleSUB (x1%, y1%, x2%, y2%, c%)Draws a rectangle5W
RepaintSUBForce repainting of listbox0W
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Draws & Fills a rounded rectangle7W
SaveToFileSUB (FileName AS STRING)Save list to file1W
StretchDrawSUB (Rect AS QRECT, BMP)Draw BMP and stretch to fit inside Rect2W
TextHeightFUNCTION (Text$) AS WORDReturns the height, in pixels, of Text$ string1W
TextWidthFUNCTION (Text$) AS WORDReturns the width, in pixels, of Text$ string1W
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Write text, and clip within region Rect6W
TextOutSUB (x%, y%, S$, fc%, bc%)Writes text to image5W

QListbox Events
EventTypeOccurs when...ParamsSupport





OnClickVOIDUser clicks on item0WXG
OnDblClickVOIDUser double clicks on an item0WXG
OnDrawItemSUB (Index%, State%, R AS QRect)Items are redrawn for ownerdraw listboxes3W
OnEnterVOID
OnEnter doesn't work, use the Form's OnKeyUp event to call a routine to get the Enter key with the Form's KeyPreview property set to True.
User presses enter to select item0W
OnMeasureItemSUB (Index%, Height%)Calculate Height for ownerdraw variable listboxes3W
WndProcSUB (Hwnd%, Msg%, wParam%, lParam%)Messages sent to Listbox4W


QListbox Examples
  DIM Form AS QForm
DIM ListBox AS QListBox

ListBox.Parent = Form
ListBox.AddItems "1. Apples", "2. Oranges", "3. Bananas"
ListBox.DelItems 1,2 '' Deletes Oranges and Bananas ListBox.Item(0) = "1. Strawberries" '-- Change the first item Form.ShowModal

Prev Component Contents Next Component