コンボボックス – ウィキペディア

before-content-x4

コンボボックス コンボボックス (から 英語 コンボボックス ) また コンビネーションフィールド グラフィカルユーザーインターフェイス(GUI)のコントロールであり、ユーザーは特定のオプションを選択するか、代わりに独自の入力を作成できます。名前 コンボボックス それは、あなたがテキストフィールドとリストフィールドの組み合わせとして( 選択リストを選択します リストボックス ドロップダウンメニュー ) 考慮することが出来る。したがって、コンボボックスを使用すると、コンボボックスのテキストボックスがオプションで可能です。または、指定されたリストエントリのいずれかの選択/変更が可能です。コンボボックスは1つと混同しないでください selectbox または1つ ドロップダウンリスト – これらは無料のユーザー入力、のコンポーネントを許可しません テキストフィールド ここにはない。

after-content-x4

どのエントリ – ユーザーによる選択の提案として – コンボボックスのリストのどの時点で表示されるかは、それぞれのアプリケーションによって異なります。また、目に見えるテキストフィールドが最初に空であるか、プリセット値が表示されているかどうかにかかわらず、コンボボックスのコンピュータープログラムへの実装の詳細にも依存します。リスト自体は最初は空になり、テキストフィールドに数字またはテキストが入力された場合にのみ、後でしかありません。

テキストフィールドと組み合わされたリストボックスは、通常、スペースを節約し、シングルラインである ドロップダウンリストボックス これは、関連するボタンが押されたときにのみ表示されます。厳密に言えば、1つを語っています ドロップダウンコンボボックス

さまざまな実装により、プログラマーはそれぞれのリストエントリに加えて小さなシンボルを表示する機会を提供します。一般に、リストエントリはテキストベースのコンテンツである必要はありません。さまざまなオフィスパッケージでは、色、hatch化、ラインタイプまたはラインもコンボボックスを介して選択できます。その背後にあるコンセプトは「所有者ドロー」と呼ばれます。 [初め]

さらに、ドロップダウンウィンドウがリストボックスでなければならない場合は必ずしもそうではありません。たとえば、Adobe PhotoshopとAdobe Indesignでは、ユーザーがコンボボックスを折りたたむと、一部の場所にスライダーが表示されます。

HTML 4とは対照的に、HTML5は選択リストを定義する機会を提供します。

< 入力  名前 = 「挨拶」  リスト = 「挨拶」  />  < データリスト  id = 「挨拶」 >  < オプション  価値 = "ミスター" > オプション >  < オプション  価値 = "女性" > オプション >  データリスト >  

それは jcombobox 編集しないようにプログラムされています( 設定可能な(false) )、それはドロップダウンリストボックスのように動作し、AWTコンポーネント 選択 。 Sunは、スイング中のマルチラインリストボックスを提供します jlist しかし、独立したドロップダウンリストボックスとしてではありませんが、「去勢」になります jcombobox 使用済み。

MS Accessのグラフィック開発環境では、コンボボックスは、録音フォームの要素タイプ「コンビネーションフィールド」として(「注文」の例で)作成され、グラフィック隣接に示されているように使用されます。この場合、開発者は(データベースからのデータ表示用)コンビネーションフィールドなどを指定します。次のプロパティ:ボックスの幅。ボックスの行数。表示される人のデータソース。人データベースのIDの名前。データベース注文uの外部キーの名前。 a。

after-content-x4

プログラミング言語C#の次の例は、コンボボックスとテキストフィールドを備えたメインウィンドウの実装と、選択イベントとイベント治療ルーチンのリンクを示しています(イベントを参照)。 [2]

使用  System.Windows.Forms ;  公共  クラス  MainForm   システム ウィンドウズ フォーム 形状  {   // MainFormのコンストラクター。   公共  MainForm ()   ベース ()   {   InitialIzeComboBox ();   initializetextbox ();   }  	// Startet die Anwendung und erzeugt das MainForm durch Aufruf des Konstruktors.     public static void Main()
    {
        Application.Run(new MainForm());
    }

    internal System.Windows.Forms.TextBox personTextBox;

    // Initialisiert das Textfeld.
    private void InitializeTextBox()
    {
		personTextBox = new System.Windows.Forms.TextBox();
		personTextBox.ScrollBars = ScrollBars.Vertical;
		personTextBox.Location = new System.Drawing.Point(50, 25);
		personTextBox.Size = new System.Drawing.Size(200, 100);
		personTextBox.Text = "Name und Anzahl der Verkommen:";
		personTextBox.Multiline = true; // Legt fest, dass die Textfeld mehrere Zeilen haben kann und Zeilenumbrüche ermöglicht
		Controls.Add(personTextBox);
    }

    internal System.Windows.Forms.ComboBox personsComboBox;

    // Initialisiert die Combobox und fügt ein Array vom Typ string hinzu.
    private void InitializeComboBox()
    {
        personsComboBox = new System.Windows.Forms.ComboBox();
        string[] personen = new string[]{"Hamilton, David", "Hensien, Kari",
                "Hammond, Maria", "Harris, Keith", "Henshaw, Jeff D.",
                "Hanson, Mark", "Harnpadoungsataya, Sariya",
                "Harrington, Mark", "Harris, Keith", "Hartwig, Doris",
                "Harui, Roger", "Hassall, Mark", "Hasselberg, Jonas",
                "Harnpadoungsataya, Sariya", "Henshaw, Jeff D.",
                "Henshaw, Jeff D.", "Hensien, Kari", "Harris, Keith",
                "Henshaw, Jeff D.", "Hensien, Kari", "Hasselberg, Jonas",
                "Harrington, Mark", "Hedlund, Magnus", "Hay, Jeff",
                "Heidepriem, Brandon D."};

        personsComboBox.Items.AddRange(personen);
        personsComboBox.Location = new System.Drawing.Point(50, 150);
        personsComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
        personsComboBox.Size = new System.Drawing.Size(200, 100);
        personsComboBox.TabIndex = 0;
        Controls.Add(personsComboBox);

        // Verknüpft die Ereignisbehandlungsmethode mit dem Auswahlereignis SelectedIndexChanged der Combobox.
        personsComboBox.SelectedIndexChanged += new System.EventHandler(personsComboBox_SelectedIndexChanged);
    }

	// Diese Methode wird aufgerufen, wenn der Benutzer die Auswahl der Combobox ändert.
	// Sie sucht alle Vorkommen des Namens der Person im Array und gibt den Namen und die Anzahl der Vorkommen im Textfeld aus.
    private void personsComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        string selectedName = (string) personsComboBox.SelectedItem;

        int numberOfOccurences = 0;
        int index = -1;

        // Ruft die Methode FindStringExact auf, um das erste Vorkommen in der Liste zu finden.
        index = personsComboBox.FindStringExact(selectedName);

		// Entfernt den gefundenen Namen und erhöht die Anzahl der gefundenen Namen.
		// Ruft dann die Methode FindStringExact erneut auf und übergibt den Index des aktuell gefundenen Elements, damit die Suche dort beginnt statt am Anfang der Liste.
		while (index != -1)
        {
            personsComboBox.Items.RemoveAt(index);
            numberOfOccurences += 1;
            index = personsComboBox.FindStringExact(selectedName, index);
        }
        // Update the text in personTextBox.
        personTextBox.Text = personTextBox.Text + "rn" + selectedName + ": " + numberOfOccurences;
    }
}
after-content-x4