Difference between revisions of "TComboBox"

From OpenEUO
Jump to: navigation, search
(Created page with "A TComboBox component is an edit box with a scrollable drop-down list attached to it. Users can select an item from the list or type directly into the edit box. * [[TComboBox.Au...")
 
 
Line 73: Line 73:
  
 
* [[TObject.ClassName]]
 
* [[TObject.ClassName]]
 +
 +
Example:
 +
 +
  cbox = Obj.Create('TComboBox')
 +
  cbox.Parent = form -- set to containing object's name
 +
  cbox.Top = 25
 +
  cbox.Left = 25
 +
  cbox.Width = 180
 +
  cbox.Items.Add('a line in the combo box')
 +
  -- add more lines
 +
  cbox.ItemIndex = 0 -- the first item is selected
 +
 +
  cbox.OnChange = function(pSender)
 +
  --[[ event fires immediately after the user edits the text in the edit
 +
  region or selects an item from the list. The Text property gives the new value in the edit region.
 +
  --]]
 +
  end
 +
 +
  cbox.OnSelect = function(pSender)
 +
  --[[ event fires when user changes the selected item in the drop-down list. OnSelect occurs after
 +
  the selection has changed and the Text property reflects the new item.
 +
  --]]
 +
  end

Latest revision as of 14:28, 14 November 2010

A TComboBox component is an edit box with a scrollable drop-down list attached to it. Users can select an item from the list or type directly into the edit box.

Inherited from TWinControl:

Inherited from TControl:

Inherited from TComponent:

Inherited from TObject:

Example:

 cbox = Obj.Create('TComboBox')
 cbox.Parent = form -- set to containing object's name
 cbox.Top = 25
 cbox.Left = 25
 cbox.Width = 180
 cbox.Items.Add('a line in the combo box')
 -- add more lines
 cbox.ItemIndex = 0 -- the first item is selected
 cbox.OnChange = function(pSender)
 --[[ event fires immediately after the user edits the text in the edit
 region or selects an item from the list. The Text property gives the new value in the edit region.
 --]]
 end
 cbox.OnSelect = function(pSender)
 --[[ event fires when user changes the selected item in the drop-down list. OnSelect occurs after
 the selection has changed and the Text property reflects the new item. 
 --]]
 end