Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej37_ListView
- Ejemplo de control ListView */
- #include <radc++.h>
- Form Form1("List View ejemplo - RAD C++ Ejemplo");
- Label label("Item de texto Seleccionado:", -1, 50, 10, 300, 25, Form1);
- ReadOnlyBox text1("", -1, 50, 40, 300, 25, Form1);
- ListView listv("", AUTO_ID, 50, 75, 300, 160, Form1);//create new listview
- FormProcedure procedure1 (FormProcArgs) {
- ON_CLOSE() Application.close();
- ON_OBJECTSELECT(listv) { //item has been selected in listview
- int selection = listv.selectedItemIndex;
- if(selection == -1) //nothing selected, it was just some other event
- text1.text = "Actualmente sin seleccion!";
- else
- text1.text = listv[listv.selectedItemIndex];
- }
- return 0;
- }
- //create new iconlist, RCP_LARGE becuase listview accepts large icons
- IconList icl(RCP_LARGE);
- //create some icon objects
- Icon icon1(IDI_HAND), icon2(IDI_ASTERISK),icon3(IDI_APPLICATION), icon4(IDI_EXCLAMATION) ;
- rad_main()
- //attach form procedure
- Form1.procedure = procedure1;
- //add icons to icon list
- icl.add(icon1);
- icl.add(icon2);
- icl.add(icon3);
- icl.add(icon4);
- //now attach iconlist to listview
- listv.setIconList(icl);
- //add some enteries to listview
- //note: 2nd argument is reserved and msut be empty string ""
- listv.add("entrada 1","",1); //3rd argument is ZERO basded index of icon in list
- listv.add("entrada 2","",2);
- listv.add("entrada 3","",3);
- listv.add("a. con icono default"); //did not pass last 2 arguments so first icon is selected
- listv.add("b. con icono default"); //did not pass last 2 arguments so first icon is selected
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement