Directory dialog box

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

LuisReyes
Posts: 17
Joined: Wed Jan 09, 2013 5:23 am

Directory dialog box

Postby LuisReyes » Fri Mar 08, 2013 3:09 am

Hi,

I am trying to make a dialog box in order to set a default directory where I store my database (which the program will load), graphs and other stuff (which the program makes). The code I am using is the following:

%directory = "path_name"
@uiedit(%directory, "Directory:")
cd {%mode}

However, once the dialog box opens the path name stops at a "space" in the path_name. My ultimate purpose is to make my program user-friendly, thus for people who do not have any knowledge on programming not to face this little issues. Could this be overcome?

PS, I also tried with

string directory = "path_name"
@uiedit(directory, "Directory:")
cd {%mode}

but it shows an error message saying "No workfile exists...use NEW or OPEN"... however I am not working with a workfile, since my program is creating it

Thanks in advance.

LR

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Directory dialog box

Postby EViews Gareth » Fri Mar 08, 2013 9:01 am

Code: Select all

%directory = "path_name" @uiedit(%directory, "Directory:") cd %directory

LuisReyes
Posts: 17
Joined: Wed Jan 09, 2013 5:23 am

Re: Directory dialog box

Postby LuisReyes » Fri Mar 08, 2013 9:45 am

Hi Gareth,

I miss-spelled the code in the first message. What I actually first tried was what you suggest, and it doesn't work. The box recognizes only a part of the path. That's what my question was about.

Thanks again in advance

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Directory dialog box

Postby EViews Gareth » Fri Mar 08, 2013 10:04 am


LuisReyes
Posts: 17
Joined: Wed Jan 09, 2013 5:23 am

Re: Directory dialog box

Postby LuisReyes » Fri Mar 08, 2013 10:20 am

Hi Gareth,

as I mentioned above: the box recognizes only a part of the path (i.e. instead of showing ALL the path, it only shows A THIRD of it). Your link only shows what I already read from the command and programming reference, so it does not really answer my question

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Directory dialog box

Postby EViews Gareth » Fri Mar 08, 2013 10:23 am

You mentioned that it stops at a "space". My example shows that a space works fine. I guess I don't understand what the issue is exactly. Perhaps you could provide more concrete details?

LuisReyes
Posts: 17
Joined: Wed Jan 09, 2013 5:23 am

Re: Directory dialog box

Postby LuisReyes » Fri Mar 08, 2013 10:33 am

The issue is that I type

%directory = "C:\Documents and Settings\Fahi_2\My Documents\..."
@uiedit(%directory, "Directory:")
cd %directory

(the three dots at the end of the path are only to show that the path goes on)

Once the box appears, what I see is only

C:\Documents and Settings\Fahi_2\My

and I cannot type anymore

there are two spaces in "Documents and Settings", so I do not think this would be the problem. Perhaps the problem is the size of the box? I could create a folder near C:\, but that would not help other users who would potentially want to save the tables and graphs in a folder of their choice.

Again, thank you for your advice

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Directory dialog box

Postby EViews Gareth » Fri Mar 08, 2013 10:59 am

Change the size of your edit box. 1024 is probably enough.

Code: Select all

%directory = "C:\Documents and Settings\Fahi_2\My Documents\..." @uiedit(%directory, "Directory:", 1024) cd %directory

LuisReyes
Posts: 17
Joined: Wed Jan 09, 2013 5:23 am

Re: Directory dialog box

Postby LuisReyes » Fri Mar 08, 2013 11:05 am

Awesome, thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests