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


QCOMBOBOX Component

QCombobox implements a simple pull down listbox. The first item in any combobox is 0, the next is 1, and so on...

QCombobox Properties
Field Type R/W Default Support





Align INTEGER RW alNone W
Align determines how the control aligns within its parent control.
Color INTEGER RW W
CopyMode INTEGER RW cmBlackness W
Cursor INTEGER RW crDefault W
DropDownCount INTEGER RW 8 W
DropDownCount is the maximum number of items displayed in the drop-down list.
Enabled INTEGER RW True WXG
Font QFONT W W
Height INTEGER RW WXG
Hint STRING RW WXG
Item ARRAY of STRING RW WXG
ItemCount INTEGER R WXG
ItemHeight INTEGER RW W
ItemIndex INTEGER RW -1 WXG
ItemIndex indicates which item in the drop-down list is selected. If no item is selected, then ItemIndex is -1.
Left INTEGER RW 0 WXG
MaxLength INTEGER RW W
MaxLength is the maximum number of characters the user can type into the edit portion of the combobox.
Parent QFORM/QPANEL/QTABCONTROL W WXG
PopupMenu QPOPUPMENU W W
ShowHint INTEGER RW False WXG
Sorted INTEGER RW False WG
Style INTEGER RW csDropDown W
Style determines the display style of the combobox.
0 = csDropDown -- A drop-down list with an edit box for manually entered text.
1 = csSimple -- A drop-down list with an edit box and a fixed list (list box) underneath.
2 = csDropDownList -- A drop-down list with no edit box for manual entry.
3 = csOwnerDrawFixed -- Owner-draw drop-down list with an edit box. Each item in the list is the height specified by the ItemHeight property.
4 = csOwnerDrawVariable -- Owner-draw drop-down list with an edit box. Each item can have varying heights.
TabOrder INTEGER RW W
Tag INTEGER RW WXG
Text STRING RW W
Top INTEGER RW 0 WXG
Visible INTEGER RW True WXG
Width INTEGER RW WXG

QCombobox Methods
Method Type Description Params Support





AddItems SUBI Add items to combobox STRINGs, Infinite WXG
Circle SUB (x1%, y1%, x2%, y2%, c%, fill%) Draw & Fill Circle 6 W
Clear SUB Clears entire Combobox 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
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 combobox 0 W
RoundRect SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) Draws & Fills a rounded rectangle 7 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

QCombobox Events
Event Type Occurs when... Params Support





OnChange VOID User selects a different item 0 WXG
OnDrawItem SUB (Index%, State%, R AS QRect) Items are redrawn for ownerdraw comboboxes 3 W
OnMeasureItem SUB (Index%, Height%) Calculate Height for ownerdraw variable comboboxes 3 W


QCombobox Examples
  DIM Form AS QForm
  DIM ComboBox AS QComboBox

  SUB ItemChanged
    PRINT ComboBox.Item(ItemIndex)
  END SUB

  ComboBox.Parent = Form
  ComboBox.OnChange = ItemChanged
  ComboBox.AddItems "1. Apples", "2. Oranges", "3. Bananas"

  Form.ShowModal

Prev ComponentContentsNext Component