Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej34_ComboBox
- Ejemplo de control ComboBox */
- #include <radc++.h>
- Form Form1("Combo Box ejemplo - RAD C++ Ejemplo");
- ComboBox combo("", AUTO_ID, 10, 15, 100, 200, Form1);//create new combo box
- Button btn_add("< Agregar esto <", AUTO_ID, 120, 15, 100, 25, Form1);
- TextBox txt_newval("Nuevo valor", AUTO_ID, 230, 15, 150, 25, Form1);
- Label label("Entrada Seleccionada", AUTO_ID, 120, 45, 260, 15, Form1);
- ReadOnlyBox txt_selected("", AUTO_ID, 120, 60, 260, 25, Form1);
- Button btn_remove("[ X ] Remover seleccion", AUTO_ID, 120,130, 260, 25, Form1);
- Button btn_select("Progmaticamente seleccionar item 2", AUTO_ID, 120,160, 260, 25, Form1);
- FormProcedure procedure1 (FormProcArgs); //prototype of form procedure
- rad_main()
- //attach form procedure
- Form1.procedure = procedure1;
- //add some enteries to combobox
- combo.add("entrada 1");
- combo.add("entrada 2");
- combo.add("entrada 3");
- combo.select(0); //select first entry
- rad_end()
- FormProcedure procedure1 (FormProcArgs) { //implementation of form procedure
- ON_CLOSE() {
- //exit application
- Application.close();
- }
- //when an item is selected, put its text in textbox txt_selected
- ON_ITEMSELECT(combo) {
- txt_selected.text = combo[combo.selectedItemIndex];
- }
- ON_COMMAND_BY(btn_add) {
- //add new value of textbox txt_newval ot combobox
- combo.add(txt_newval.text);
- }
- ON_COMMAND_BY(btn_remove) {
- //remove selected item in combobox
- combo.remove(combo.selectedItemIndex);
- }
- ON_COMMAND_BY(btn_select) {
- //remove selected item in combobox
- combo.select(1); //1 means item 2, items have ZERO based indeses
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement