"I'm trying to write a component that shows a folder tree"
The CDK has a CDKFSELECT widget.
Displays a list of directories and files that may work for you, or the source code of CDKFSELECT can be used for your own solution.
CDKFSELECT *fSelect = 0; int HEIGHT = 0; int WIDTH = 0; char *title = new char[strlen("Pick a file to open") + 1]; strcpy(title, "Pick a file to open"); char *prompt = new char[strlen("==> ") + 1]; strcpy(prompt, "==> "); char *directoryAttribute = new char[strlen("</B>") + 1]; strcpy(directoryAttribute, "</B>"); char *fileAttribute = new char[strlen("</N>") + 1]; strcpy(fileAttribute, "</N>"); char *linkAttribute = new char[strlen("</D>") + 1]; strcpy(linkAttribute, "</D>"); char *sockAttribute = new char[strlen("</D>") + 1]; strcpy(sockAttribute, "</D>"); boolean displayBox = TRUE; boolean displayShadow = FALSE; fSelect = newCDKFselect(pCdkScreen, TOP, LEFT, HEIGHT, WIDTH, title, prompt, A_NORMAL, '_', A_REVERSE, directoryAttribute, fileAttribute, linkAttribute, sockAttribute, displayBox, displayShadow); char *filename = activateCDKFselect(fSelect, 0); destroyCDKFselect(fSelect); delete [] title; delete [] prompt; delete [] directoryAttribute; delete [] fileAttribute; delete [] linkAttribute; delete [] sockAttribute;
mrflash818
source share