The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Dialog to select a folder

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 10/30/2003 : 3:13:53 PM
HI,

Is there any way I can set a dialog to search/browse for a folder rather than a file(s) in the folder eg user wants to selct a folder and assume that all files in that folder are then opened and appended into one worksheet?

Thanks,

Cheers,

Pete

5   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 10/31/2003 : 03:16:02 AM
Hi,

Thanks alot for the assist Mike and Ruthven - much appreciated.

Cheers,

Pete

rlewis Posted - 10/30/2003 : 6:55:53 PM
Here is a bit more compact OriginC approach using Fdlog.OpenPath (see Mike Buess"s post above ...

bool List_All_Files_In_Directory(void)
{
if(!LabTalk.Fdlog.OpenPath("Z"))
{
char strBuffer[MAXFULLPATH];
LT_get_str("%Z",strBuffer,MAXFULLPATH);
string PathToFileName, PathToFiles=strBuffer+"*.*";
WIN32_FIND_DATAA findFile;
HANDLE hFile;
int NumFiles=0;
if((hFile=FindFirstFile(PathToFiles,&findFile)) != INVALID_HANDLE_VALUE)
{
PathToFileName=strBuffer+findFile.cFileName;
if(PathToFileName.IsFile())
{
out_str(findFile.cFileName);
NumFiles ++;
}
while (FindNextFile(hFile, &findFile)==true)
{
PathToFileName=strBuffer+findFile.cFileName;
if(PathToFileName.IsFile())
{
out_str(findFile.cFileName);
NumFiles ++;
}
}
string strTemp;
strTemp.Format("%d",NumFiles);
out_str(strTemp+" Files found");
return (true);
}
}
return (false);
}


It has the advantage that you do not have to select a file from the directory to activate the process. But on the down side you do not get to see what files are in the directory before selecting the directory
rlewis Posted - 10/30/2003 : 5:17:31 PM
Opps .. forgot to mention ..
With the OriginC approach outlined above .. you can navigate to the directory, but wou will have to select one of the files in the directory (its the only way the Okay button becomes active) ...
rlewis Posted - 10/30/2003 : 5:14:33 PM
Hi Pete..

You may alos find the following OriginC approach useful ...
bool FDLOG_LT_init(void)
{
// .... Initialize the LabTalk FDLOG Object
LabTalk.FDLOG.Reset();
LabTalk.FDLOG.DlgName$="";
LabTalk.FDLOG.OptionDLG$=""; //Reset button to off
LabTalk.FDLOG.checkname$=""; //Reset check box to null
LabTalk.FDLOG.ShowComment=0; //close the comments box
LabTalk.FDLOG.CheckStatus=0; //Set checkbox to off
LabTalk.FDLOG.default$=""; //Clrar the "File Name" edit box
LabTalk.FDLOG.MultiOpen.ComboName$="";
if(LabTalk.FDLOG.MultiOpen.ComboSel<1 || LabTalk.FDLOG.MultiOpen.ComboSel>3)
{
LabTalk.FDLOG.MultiOpen.ComboSel = 2;// import into new columns
}
return (true);
}
bool All_Files_In_Directory(void)
{
if (FDLOG_LT_init())
{
LabTalk.FDLOG.numTypes=1;
LabTalk.FDLOG.type1$="[All files]*.*";
LabTalk.FDLOG.Dlgname$="Select one or more Files in Directory";
if (LabTalk.FDLOG.multiopen()==0)
{
string PathToFileName, PathToFiles=LabTalk.Fdlog.Path$+"\\*.*";
WIN32_FIND_DATAA findFile;
HANDLE hFile;
int NumFiles=0;
if((hFile=FindFirstFile(PathToFiles,&findFile))!= INVALID_HANDLE_VALUE)
{
PathToFileName=LabTalk.Fdlog.Path$+"\\"+findFile.cFileName;
if(PathToFileName.IsFile())
{
out_str(findFile.cFileName);
NumFiles ++;
}
while (FindNextFile(hFile, &findFile)==true)
{
PathToFileName=LabTalk.Fdlog.Path$+"\\"+findFile.cFileName;
if(PathToFileName.IsFile())
{
out_str(findFile.cFileName);
NumFiles ++;
}
}
string strTemp;
strTemp.Format("%d",NumFiles);
out_str(strTemp+" Files found");
return (true);
}
}
}
return (false);
}
Mike Buess Posted - 10/30/2003 : 5:01:26 PM
Hi Pete,

I think this is what you're looking for...

fdlog.OpenPath(B); // Open a folder selection dialog, assign selected path to %B

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000