Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej35_MultiColumnListBox
- Ejemplo para mostrar el control ListBox con mas de una columna */
- #include <radc++.h>
- Form Form1("Multi-Columna List Box ejemplo - RAD C++ Ejemplo");
- MCListBox list("", AUTO_ID, 10, 15, 370, 100, Form1);//create new mc list box
- Button btn_add("^ Agregrar esto <", AUTO_ID, 120, 115, 100, 25, Form1);
- TextBox txt_newval("nuevo", AUTO_ID, 230, 115, 150, 25, Form1);
- Label label("Entrada Seleccionada", -1, 120, 145, 260, 15, Form1);
- ReadOnlyBox txt_selected("", AUTO_ID, 120, 160, 260, 25, Form1);
- Button btn_remove("[ X ] Remover item seleccionado", AUTO_ID, 120,200, 260, 25, Form1);
- Button btn_select("Progmaticamente seleccionar item 2", AUTO_ID, 120,230, 260, 25, Form1);
- FormProcedure procedure1 (FormProcArgs); //prototype of form procedure
- rad_main()
- //attach form procedure
- Form1.procedure = procedure1;
- //add some enteries to listbox
- for(int i=1; i<=40; i++)
- list.add("item "+str(i));
- list.select(0); //select first entry
- list.setColumnWidth(50);
- 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
- int selection=list.selectedItemIndex;
- if(selection==-1)
- Form1.warnBox("No item seleccionado!");
- list.remove(selection);
- }
- 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