Creates a ComboBox control.
ComboBox ID%, x%, y%, w%, h%[,style%]
A ComboBox is a combination of a ListBox with a static text field or with an EditText element. If the ComboBox contains a static text field, the selected entry from the ListBox is shown in it. Additional style elements for a ComboBox are WS_TABSTOP, WS_GROUP, WS_VSCROLL and WS_DISABLED.
style%:
CBS_SIMPLE ($0001) - specifies a ListBox, which is always shown.
CBS_DROPDOWN ($0002) - similar to CBS_SIMPLE. However, the ListBox is only displayed when the user performs the relevant selection (for example open or change).
CBS_DROPDOWNLIST ($0003) - similar to CBS_DROPDOWN. The difference is that the selection window (edit control) contains the predefined text until the user makes the selection.
CBS_OWNERDRAWFIXED ($0010) - specifies a ListBox, whose input must be performed by the calling task. All items within this ListBox have the same height.
CBS_OWNERDRAWVARIABLE ($0020) - similar to CBS_OWNERDRAWFIXED, except that the items can here have a variable height.
CBS_AUTOHSCROLL ($0040) - when the user enters text which goes beyond the windows or editfield edge the text is automatically scrolled within the output window (edit control).
CBS_OEMCONVERT ($0080) - converts characters from ANSI into OEM and back (for example using your own character table).
CBS_SORT ($0100) - automatically sorts all inputs in a ListBox.
CBS_HASSTRINGS ($0200) - used when items within a ComboBox are composed of strings. The ComboBox refers items to strings by using pointers.
Local i%, sel$
Debug .Show
Dlg 3D On : Local x%
Dialog # 1, 20, 20, 300, 200, "Test"
ComboBox "Combobox", 20, 40, 50, 200, 120, CBS_DROPDOWN | _
CBS_SORT | 2048 | WS_TABSTOP
PushButton "OK", IDOK, 60, 140, 80, 25, BS_DEFPUSHBUTTON | WS_TABSTOP
PushButton "CANCEL", IDCANCEL, 150, 140, 64, 24, BS_DEFPUSHBUTTON | WS_TABSTOP
EndDialog
Data "GFA-BASIC 32"
Data "GFA-BASIC for MS-DOS"
Data "GFA-BASIC for Windows"
Data "GFA-BASIC for Atari"
Data "GFA-BASIC for Amiga"
Data ""
For i% = 0 To 5
Read sel$
~SendMessage(Dlg(1, 20), CB_ADDSTRING, 0, sel$)
_Win$(DlgItem(1, 20)) = sel$
Next
ShowDialog # 1
Do
Sleep
Until Me Is Nothing
Dlg 3D Off
Sub Dlg_1_Message(hWnd%, Mess%, wParam%, lParam%)
Switch Mess
Case WM_COMMAND
Switch LoWord(wParam)
Case 20
Trace "Notification code: " & HiWord(wParam)
Case IDOK, IDCANCEL
CloseDialog # 1
EndSwitch
EndSwitch
EndSub
This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.
With the general Control statement any control type can be created.
Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl, Ocx
{Created by Sjouke Hamstra; Last updated: 25/09/2014 by James Gaite}