Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot Reset InitialDir for OpenDialog

864 views
Skip to first unread message

Tom Foran

unread,
May 4, 2001, 10:51:08 AM5/4/01
to
It seems that 'InitialDir' really means the initial directory for the
session. I put an OpenDialog on a form, set the InitialDir and Execute
the dialog.

If the user changes the directory and Opens a file, when the
OpenDialog is Executed again, it will point to the directory where the
previous file was opened, not the InitialDir even though InitalDir has
been reset.

Do I need to change something so each time the Dialog opens it points
to the InitialDir?

A couple of more questions I have about the Open and Save Dialog:

1) Is there a way to control the size of the form when it opens.
It seems to remember the size if it is resized, but is there a way to
set it?

2) Is there a way to show details instead of the list. This acts like
the size.

3) If the user changes the file type, I would like to change the
directory. Is there any way to do this?

Thanks.

Todd

unread,
May 4, 2001, 11:15:46 AM5/4/01
to

"Tom Foran" <Tom_Foran@-no-spam-BigFoot.com> wrote in message
news:q0g5ft0r1pjm7cpom...@4ax.com...

> It seems that 'InitialDir' really means the initial directory for the
> session. I put an OpenDialog on a form, set the InitialDir and Execute
> the dialog.
>
> If the user changes the directory and Opens a file, when the
> OpenDialog is Executed again, it will point to the directory where the
> previous file was opened, not the InitialDir even though InitalDir has
> been reset.
>
> Do I need to change something so each time the Dialog opens it points
> to the InitialDir?
>

Clear the FileName property.

> A couple of more questions I have about the Open and Save Dialog:
>
> 1) Is there a way to control the size of the form when it opens.
> It seems to remember the size if it is resized, but is there a way to
> set it?

Nope.


>
> 2) Is there a way to show details instead of the list. This acts like
> the size.
>

Nope.

> 3) If the user changes the file type, I would like to change the
> directory. Is there any way to do this?

You need to do this Before the dialog is displayed. You can write your own OpenDialog
very easily.


Finn Tolderlund

unread,
May 4, 2001, 11:17:34 AM5/4/01
to

"Tom Foran" <Tom_Foran@-no-spam-BigFoot.com> skrev i en meddelelse
news:q0g5ft0r1pjm7cpom...@4ax.com...

> Do I need to change something so each time the Dialog opens it points
> to the InitialDir?

OpenDialog1.FileName := '';

Finn Tolderlund

Iman L Crawford

unread,
May 4, 2001, 11:17:55 AM5/4/01
to
Tom Foran <Tom_Foran@-no-spam-BigFoot.com> wrote in
<q0g5ft0r1pjm7cpom...@4ax.com>:
>Do I need to change something so each time the Dialog opens it points
>to the InitialDir?

Not sure, but it may be the initial dir when the dialog is created. Try
creating the dialog at runtime instead of design time.

>
>A couple of more questions I have about the Open and Save Dialog:
>
>1) Is there a way to control the size of the form when it opens.
>It seems to remember the size if it is resized, but is there a way to
>set it?

I think you can send a WM_SIZE message to the hwnd of the dialog. Not sure
about this

>2) Is there a way to show details instead of the list. This acts like
>the size.

Not sure

>
>3) If the user changes the file type, I would like to change the
>directory. Is there any way to do this?

Look at the events one is something like OnTypeChange.


--
Iman
"I was looking handsome,
she was looking like an erotic vulture" The Pixies

Tom Foran

unread,
May 4, 2001, 11:52:14 AM5/4/01
to
Thanks,

Clearing the FileName did it.

I am considering writing my own OpenDialog.

Tom

Sanford Aranoff

unread,
May 4, 2001, 11:46:43 AM5/4/01
to

I save InitialDir in the registry after Execute, which is used next time
the dialog is opened.

Iman L Crawford

unread,
May 4, 2001, 11:55:17 AM5/4/01
to
Sanford Aranoff <sara...@nusinc.com> wrote in
<3AF2CEE3...@nusinc.com>:

>I save InitialDir in the registry after Execute, which is used next time
>the dialog is opened.

I didn't realize the previous filename would set the directory, I almost
always create my dialogs at run time, so I've never been bothered by this.

Sanford Aranoff

unread,
May 4, 2001, 5:22:08 PM5/4/01
to
Yes, but you want to open by default where you were last time.

I also use the Registry for a recent file history list.

0 new messages