Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a simple example for <i> SMALL ICONIC VIEW USING WXLISTCTRL </i>.Please place this code inside the class declaration.I did it in Frame based Windows Application using <strong>CODE BLOCKS</strong>.It will be useful to you.</p> <p><code>wxImageList *il=new wxImageList(32,32,false,0);</code></p> <p><code>wxImageList *i2=new wxImageList(32,32,false,0);</code></p> <pre><code> wxDir dir(wxGetCwd()); wxDir dir1(wxGetCwd()); if ( !dir.IsOpened() ) { // deal with the error here - wxDir would already log an error message // explaining the exact reason of the failure return; } if ( !dir1.IsOpened() ) { // deal with the error here - wxDir would already log an error message // explaining the exact reason of the failure return; } puts("Enumerating object files in current directory:"); wxString path, filename, dirstring,filename1, dirstring1, img,imgPath,path1,img1,imgPath1; int i=0; path=wxT("C:\\testing\\splitterwindow\\set\\devices"); path1=wxT("C:\\testing\\splitterwindow\\set\\actions"); img=wxT("C:\\testing\\splitterwindow\\set\\devices\\"); img1=wxT("C:\\testing\\splitterwindow\\set\\actions\\"); bool cont=dir.Open(path); bool cont1=dir1.Open(path1); cont = dir.GetFirst(&amp;filename, wxEmptyString, wxDIR_DEFAULT); dirstring.Append(filename.c_str()); cont1 = dir1.GetFirst(&amp;filename1, wxEmptyString, wxDIR_DEFAULT); dirstring1.Append(filename1.c_str()); while ( cont ) { imgPath.clear(); cont = dir.GetNext(&amp;filename); dirstring.Append(filename.c_str()); // Consturct the imagepath imgPath.Append(img.c_str()); imgPath.Append(filename.c_str()); //Now, add the images to the imagelist il-&gt;Add(wxBitmap(wxImage(imgPath.c_str()))); i++; } while ( cont1 ) { imgPath1.clear(); cont1 = dir1.GetNext(&amp;filename1); dirstring1.Append(filename1.c_str()); // Consturct the imagepath imgPath1.Append(img1.c_str()); imgPath1.Append(filename1.c_str()); //Now, add the images to the imagelist i2-&gt;Add(wxBitmap(wxImage(imgPath1.c_str()))); i++; } //assigning the imagelist to listctrl ListCtrl1-&gt;AssignImageList(il, wxIMAGE_LIST_SMALL); ListCtrl3-&gt;AssignImageList(i2, wxIMAGE_LIST_SMALL); for(int j=0;j &lt; il-&gt;GetImageCount()-1;j++) { wxListItem itemCol; itemCol.SetId(j); itemCol.SetImage(j); itemCol.SetAlign(wxLIST_FORMAT_LEFT); ListCtrl1-&gt;InsertItem(itemCol); } for(int k=0;k &lt; i2-&gt;GetImageCount()-1;k++) { wxListItem itemCol1; itemCol1.SetId(k); itemCol1.SetImage(k); itemCol1.SetAlign(wxLIST_FORMAT_LEFT); ListCtrl3-&gt;InsertItem(itemCol1); } </code></pre> <p>`</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload