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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Extension Group
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

illysam

Canada
13 Posts

Posted - 12/15/2003 :  11:01:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

for an add-on that I'm writing (Origin7, SR4), I need an open box that displays a group of file types (e.g. '*.dat' and '*.txt') at the same time.

How can I do this in OriginC?

Thanks, Rolf

Mike Buess

USA
3037 Posts

Posted - 12/15/2003 :  2:41:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Rolf,

The Origin C GetOpenBox() function will show either DAT or TXT files, but not both at the same time. (At least I haven't figured out how to do that.)

string sFile;
StringArray saFiletypes;
saFiletypes.SetSize( 2 );
saFiletypes[0]="[DAT files (*.dat)] *.dat";
saFiletypes[1]="[TXT files (*.txt)] *.txt";
sFile = GetOpenBox(saFiletypes,GetAppPath(),"","Open");
out_str(sFile); // full path of selected file

However, LabTalk's fdlog.open() will show DAT and TXT files at the same time...

char sFile[100];
using fdlog = LabTalk.fdlog;
fdlog.numTypes = 1;
fdlog.type1$ = "[Data files (*.dat;*.txt)] *.dat;*.txt";
fdlog.path$ = GetAppPath();
fdlog.open("A");
string sPath = fdlog.path$;
LT_get_str("%A",sFile,100);
out_str(sPath+sFile);

...Just figured out how to do it with GetOpenBox(). It requires an extra pair of quotes.

string sFile;
StringArray saFiletypes;
saFiletypes.SetSize( 1 );
saFiletypes[0]="\"[DAT files (*.dat;*.txt)] *.dat;*.txt\"";
sFile = GetOpenBox(saFiletypes,GetAppPath(),"","Open");
out_str(sFile); // full path of selected file

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 12/15/2003 2:42:57 PM

Edited by - Mike Buess on 12/15/2003 2:48:38 PM
Go to Top of Page

illysam

Canada
13 Posts

Posted - 12/15/2003 :  2:59:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike,

works like a charm!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000