CreateComboBox ( x,y,width,height,group[,style] )

Parameters

x,y - position of the combo box's top-left corner within the group's client area

width,height - size of the closed combo box in logical pixels (scaled for display DPI)

group - window or gadget group that owns the combo box

style (optional) - 0 (default); other values are reserved

Description

Creates a drop-down combo box gadget and returns its handle.

The height controls the closed field, including its border, so a combo box and a button with the same height line up. SetGadgetShape can change this height later. The control keeps a minimum height that fits its font and icons; the popup list is sized separately and can scroll through longer lists.

A combo box offers a list of choices while taking up only a single line - the natural control for things like a quality preset, an entity type or a texture filter mode in an options panel. Fill it with AddGadgetItem, and read the user's choice with SelectedGadgetItem and GadgetItemText.

When the user picks an entry, the combo posts a gadget-action event ($401) through the shared event queue with the new selection index in EventData and the combo's handle in EventSource. Item text is UTF-8, items can show icons from a strip assigned with SetGadgetIconStrip, and SetGadgetHint can display grey cue text until a value is chosen - only text fields and combo boxes support hints.

See it working in the layout and controls sample; the world editor shell sample shows the editor pattern around it.


See also: AddGadgetItem, SelectedGadgetItem, GadgetItemText, CreateListBox, SetGadgetHint, SetGadgetIconStrip.

Index