Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej33_ListBox
- Ejemplo del control ListBox */
- #include <radc++.h>
- Form Form1("List Box ejemplo - RAD C++ Ejemplo");
- ListBox list("", AUTO_ID, 10, 15, 100, 200, Form1);//create new list 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("Selecciona Entrada", 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 listbox
- list.add("entrada 1");
- list.add("entrada 2");
- list.add("entrada 3");
- list.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(list) {
- txt_selected.text = list[list.selectedItemIndex];
- }
- ON_COMMAND_BY(btn_add) {
- //add new value of textbox txt_newval ot listbox
- list.add(txt_newval.text);
- }
- ON_COMMAND_BY(btn_remove) {
- //remove selected item in listbox
- list.remove(list.selectedItemIndex);
- }
- ON_COMMAND_BY(btn_select) {
- //remove selected item in listbox
- list.select(1); //1 means item 2, items have ZERO based indeses
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement