Appendix A: QLISTBOX
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
Field | Type | R/W | Default | Support |
|
|
|
|
|
Align | INTEGER | RW | alNone | W |
| Align determines how the control aligns within its parent control.
|
BorderStyle | INTEGER | RW | bsSingle | W |
Color | INTEGER | RW | | WX |
Columns | INTEGER | RW | 0 | W |
| Columns specifies the number of columns, in a multi-column listbox, that are visible without having to scroll.
|
CopyMode | INTEGER | RW | cmBlackness | W |
Cursor | INTEGER | RW | crDefault | W |
Enabled | INTEGER | RW | True | WXG |
ExtendedSelect | INTEGER | RW | True | WX |
| ExtendedSelect determines if the user can select a sequential range of items in the listbox.
|
Font | QFONT | W | | W |
Height | INTEGER | RW | | WXG |
Hint | STRING | RW | | WXG |
Item | ARRAY of STRING | RW | | WXG |
| Item contains the strings that appear in the listbox.
|
ItemCount | INTEGER | R | | WXG |
ItemHeight | INTEGER | RW | | W |
ItemIndex | INTEGER | RW | | WXG |
Left | INTEGER | RW | 0 | WXG |
MultiSelect | INTEGER | RW | False | WX |
Parent | QFORM/QPANEL/QTABCONTROL | W | | WXG |
PopupMenu | QPOPUPMENU | W | | W |
SelCount | INTEGER | R | | W |
Selected | ARRAY of INTEGER | RW | | WX |
ShowHint | INTEGER | RW | False | WXG |
Sorted | INTEGER | RW | False | WG |
| Sorted specifies whether the items in a listbox are arranged alphabetically.
|
Style | INTEGER | RW | lbStandard | W |
| 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.
|
TabOrder | INTEGER | RW | | W |
TabWidth | INTEGER | RW | 0 | W |
Tag | INTEGER | RW | | WXG |
Text | STRING | RW | | W |
| Text defines the items in the listbox as CRLF terminated strings.
|
Top | INTEGER | RW | 0 | WXG |
TopIndex | INTEGER | RW | | W |
Visible | INTEGER | RW | True | WXG |
Width | INTEGER | RW | | WXG |
QListbox Methods
Method | Type | Description | Params | Support |
|
|
|
|
|
AddItems | SUBI | Add items to listbox | STRINGs, Infinite | WXG |
Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle | 6 | W |
Clear | SUB | Clears entire listbox | 0 | WXG |
CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W |
DelItems | SUBI | Delete items by their index | Index #s, Infinite | WXG |
Draw | SUB (x%, y%, BMP) | Draw Bitmap at (X,Y) | 3 | W |
FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | W |
InsertItem | SUB (Index%, String$) | Insert item at Index% | 2 | WXG |
Line | SUB (x1%, y1%, x2%, y2%, c%) | Draws a line | 5 | W |
LoadFromFile | SUB (FileName AS STRING) | Load file to list | 1 | W |
Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | W |
Pset | SUB (x%, y%, c%) | Pixel plot | 3 | W |
Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | W |
Repaint | SUB | Force repainting of listbox | 0 | W |
RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W |
SaveToFile | SUB (FileName AS STRING) | Save list to file | 1 | W |
StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W |
TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W |
TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W |
TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W |
TextOut | SUB (x%, y%, S$, fc%, bc%) | Writes text to image | 5 | W |
QListbox Events
Event | Type | Occurs when... | Params | Support |
|
|
|
|
|
OnClick | VOID | User clicks on item | 0 | WXG |
OnDblClick | VOID | User double clicks on an item | 0 | WXG |
OnDrawItem | SUB (Index%, State%, R AS QRect) | Items are redrawn for ownerdraw listboxes | 3 | W |
OnEnter | VOID | User presses enter to select item | 0 | W |
OnMeasureItem | SUB (Index%, Height%) | Calculate Height for ownerdraw variable listboxes | 3 | W |
WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages sent to Listbox | 4 | W |
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
|
|