-
Notifications
You must be signed in to change notification settings - Fork 0
ComboBox
Tyberious edited this page Sep 4, 2023
·
1 revision
The ComboBox class is a part of the SimpleConsole.Controls library, designed to create a combo box control for console-based user interfaces. It allows users to select an option from a dropdown list.
-
XandY: Set the position of the checkbox. -
BackgroundColorandForegroundColor: Customize colors for the checkbox. -
Items: Gets or sets the list of items to be displayed in the dropdown menu. -
SelectedIndex: Gets or sets the index of the selected item -
MaxLength: Gets or sets the maximum length of the combobox -
SelectedText: Gets or sets the text of the currently selected item in the ComboBox.
-
ShowList(): Displays the list of items in the combobox and handles user input for selecting an item -
SetFocus(): Sets focus on the ComboBox, allowing the user to interact with it. If Enter is pressed and the ComboBox is not already expanded, it displays the dropdown list.
ComboBox comboBox = new ComboBox();
comboBox.X = 5;
comboBox.Y = 5;
comboBox.Items = new List<string> { "Option 1", "Option 2", "Option 3" };
comboBox.SetFocus();