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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

starting getdir() at a specific folder in a tree 2

Status
Not open for further replies.

Jerim65

Technical User
Aug 8, 2010
99
AU

I have recorded the previously chosen folder in a getdir() and users don't like starting from root again.

Is it possible to start getdir() at a specific folder in a tree.

Thanks

Coldan

 
Coldan,

The only way I know to do this is to set the default directory to the required starting point, and then to set it back again afterwards:

Code:
lcOld = SET("DEFAULT")
SET DEFAULT TO <the folder in question>
lcFile = GETDIR()
...
...
SET DEFAULT TO &lcOld

Not very elegant, but it works.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 

xfolder = 'Drive:\folder'

getdir(xfolder)

 
Mike,

Using your code - as I see it the dialogue returns to the total path display ie Desktop at the top with the previously mentioned 'root' opened and the previously chosen folder outlined, however this may be below the bottom edge of the dialogue.

But it appears there is no way to get the display to scroll to the 'root' above.

Or is there?

Coldan
 
Coldan,

The reason I was confused (in your other thread thread184-1622993) was the use of the term "root". I think you mean the directory above a given directory?

If so, either the solution that Doug Hennig gave in the other thread, or the one that I gave, will tell you the directory to start from. Then it's just a matter of setting the default, as shown above.

That's assuming you are using GETFILE(). But if you are using GETDIR(), you don't need to bother setting the default directory. Just pass the directory as the first parameter, as MM suggested.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
AS mentioned in thread184-1622993: Finding 'root' of a path)

I am setting the currently focussed path to parent folder

------------
Set default to (cStartingFolder)

cPathToReturn = GetDir((cStartingFolder),'please choose a folder','Select',64)

------------

The getdir() control shows this folder opened with a grey outline when the control opens.

So this is working - thanks to many.

However in some extensive (many drives or mapped path ) systems this folder may well be below the bottom edge of the control.

Question.

Is it possible to automagically scroll the contents of the getdir()dialogue box down when it opens?

- or less desirable

Lengthen the control (getdir()dialogue box) automagically as the user can do manually by grabbing the lower border and pulling down?

Regards

Coldan
 
If I do GetDir with a rootdir down low the dialog does autoscroll, I'm on Vista.

What would definately blend out all drives and directories above a root path is using the 5th lRootOnly parameter of GetDir():

GetDir(cRootpath,"choose a directory","myApp",64,.T.)

The .T. at the end puts cRootpath at the top of the list and you won't be able to go up, only be able choose something below.

Bye, Olaf.
 
Coldan,

You say " ... in some extensive (many drives or mapped path ) systems this folder may well be below the bottom edge of the control."

I'm not seeing that. Even if the selected item is well down the list, it is still visible within the control.

Make sure that the fourth parameter to GETDIR() is 64 or higher (as in Olaf's example). That will give you the "new style" dialogue, which might behave more as you expect.

Note also that this new style dialogue is manually resizable, which might also help your users in navigating it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Hi Mike.

>Make sure that the fourth parameter to GETDIR() is 64 or higher

My code _is _

C>cPathToReturn = GetDir((cStartingFolder),'please choose a folder','Select',64)

>Note also that this new

that's what I meant when I said

C>as the user can do manually by grabbing the lower border and pulling down?


As my app asks the user whether they want to start at the previous 'root', the 5th parameter (.T.) certainly gives what I believe my users want - this is what I had missed.

I will await feedback from my beta testers after I have changed the code.

So thanks to everyone especially Mike and Olaf for the suggestions.

Coldan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top