Code: Select all
import "ecere"
class Form1 : Window
{
text = "Form1";
background = activeBorder;
borderStyle = sizable;
hasMaximize = true;
hasMinimize = true;
hasClose = true;
tabCycle = true;
size = { 576, 432 };
nativeDecorations = true;
String s;
s = (s = new char[MAX_LOCATION], GetWorkingDir(s, MAX_LOCATION), s);
SavingDataBox pathBox
{
this, size = { 301, 20 }, anchor = { left = 176, top = 24, right = 91 }, data = &s; type = class(DirPath);;
};
Label label1 { this, text = "(D)请输入或选择文件路径:", altD, size = { 140, 13 }, position = { 24, 24 }, labeledWindow = pathBox };
Button btnView
{
this, text = "(V)iew", altV, minClientSize = { 55, 21 }, isDefault = true, size = { 55, 21 }, anchor = { top = 24, right = 25 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
this.txtFiles.Clear();
listDir(s);
return true;
}
};
EditBox txtFiles { this, text = "editBox1", anchor = { left = 16, top = 64, right = 18, bottom = 17 }, hasHorzScroll = true, hasVertScroll=true, fullRender = true, readOnly = true, multiLine=true };
void listDir(char* path)
{
FileListing listing {path};
while(listing.Find())
{
if(listing.stats.attribs.isDirectory)
{
listDir(listing.path) ;
}
else
{
this.txtFiles.AddS(listing.path);
this.txtFiles.AddS("\n");
}
}
this.txtFiles.SetViewToCursor(true);
}
bool OnPostCreate(void)
{
pathBox.Activate();
return true;
}
~Form1()
{
delete s;
}
}
Form1 form1 {};