Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Default dir

Status
Not open for further replies.

lashwarj

IS-IT--Management
Nov 1, 2000
1,067
US
I have this code in a command button

LOCAL lcImage
lcImage = GETFILE("JPG")
IF EMPTY(lcImage)
This.Caption = &quot;Select Image \<File&quot;
ENDIF
IF !empty(lcImage)
REPLACE historian.photo WITH lcImage
THISFORM.REFRESH
ENDIF


where in this code would i specify that i wanted it to always open c:\images for the default dir of image locations
 
lashwarj

LOCAL lcImage
SET DEFA TO C:\Images
lcImage = GETFILE(&quot;JPG&quot;)
IF EMPTY(lcImage)
[tab]This.Caption = &quot;Select Image \<File&quot;
ELSE
[tab]REPLACE historian.photo WITH lcImage
[tab]THISFORM.REFRESH
ENDIF

Chris :)
 
You need to change your default directory to the images directory before you call getfile ie:


* we need to remember the current directory first...
lcOldDir = sys(5)+sys(2003)

CD c:\images
lcImage = GETFILE(&quot;JPG&quot;)

* now restore the default dir (in case it's used elsewhere)
cd (lcOldDir)


Hope this helps.
 
HI
In the plac of getfile you can use...

lcImage = LOCFILE(&quot;c:\myDir\*&quot;,&quot;*.jpg&quot;)

If you are storing all yor jpg files in an 'Image' subDirectory in the default directory ..

You can code in the place of &quot;C:\myDir\*&quot;
[COLOR=/blue]
lcImage = LOCFILE(SYS(2003)+&quot;\Images\*&quot;,&quot;*.jpg&quot;)
[COLOR=/]
This way you are not disturbing the current default directory also and so no path problems ill get in.

:)
ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
My Keyboard is acting shit.. I got to change it soon... so many characters I puch are getting missed out... ooooooouch.. not puch.. 'punch'. :)

In above posting.. plac is place.. ill is will.. hmmmmm..
Have a laughhhhh !
ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
If you use the comdlg object to get an open file dialog you can just set the path (UNC preferably). This is an easy and familiar-to-your-end-user way of selecting a file.
 
Another thing that might be worth noting is the difference between GETFILE() and LOCFILE().

LOCFILE() is not GETFILE() with a path variable added, which, IMHO, it should be.

If you ignore the path variable, it has 2 parameters against the 5 parameters of GETFILE().

GETFILE() offers a developer more scope in terms of user interface, if that is important to the application - if not, LOCFILE() is far simpler to implement because the inclusion of the path variable.

GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption] [, nButtonType] [, cTitleBarCaption])

LOCFILE(cFileName [, cFileExtensions] [, cFileNameCaption])

Chris :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top