Board index » cppbuilder » change current directory in TOpenDialog

change current directory in TOpenDialog


2004-08-04 11:25:36 PM
cppbuilder26
Hi,
In a TOpenDialog, I have defined three different file types in the
drop down box.
I am keeping tract of the last folder used to open any of the files types
void __fastcall TMainForm::OpenDialogFolderChange(TObject *Sender)
{
AnsiString CurDir = GetCurrentDir();
if( OpenDialog->FilterIndex == 3 )
StartDir3 = CurDir;
else if( OpenDialog->FilterIndex == 2 )
StartDir2 = CurDir;
else // OpenDialog->FilterIndex == 1;
StartDir1 = CurDir;
}
what do I need to do to change the folder displayed in the OpenDialog
when I change the file type?
void __fastcall TMainForm::OpenDialogTypeChange(TObject *Sender)
{
if( OpenDialog->FilterIndex == 3 )
{what goes here?} = StartDir3;
else if( OpenDialog->FilterIndex == 2 )
{what goes here?} = StartDir2;
else // OpenDialog->FilterIndex = 1;
{what goes here?} = StartDir1;
}
thanks!
Stephan
 
 

Re:change current directory in TOpenDialog

On Wed, 4 Aug 2004 11:25:36 -0400, Stephan <ask me @ kilroy.wuz.here>
wrote:
Quote
what do I need to do to change the folder displayed in the OpenDialog
when I change the file type?
OpenDialog->InitialDir
--
Mark Jacobs
DK Computing
www.dkcomputing.co.uk
 

Re:change current directory in TOpenDialog

void __fastcall TMainForm::OpenDialogTypeChange(TObject *Sender)
{
AnsiString ChangeDir;
OpenDialog->Files->Clear();
OpenDialog->FileName = "";
if( OpenDialog->FilterIndex == 3 )
ChangeDir = StartDir3;
else if( OpenDialog->FilterIndex == 2 )
ChangeDir = StartDir2;
else // OpenDialog->FilterIndex = 1;
ChangeDir = StartDir1;
OpenDialog->InitialDir = ChangeDir;
//SetCurrentDir( ChangeDir );
}
I've tried both OpenDialog->InitialDir = ChangeDir and
SetCurrentDir( ChangeDir ), neither change the forder
displayed in the OpenDialog
 

{smallsort}

Re:change current directory in TOpenDialog

"Mark Jacobs" < XXXX@XXXXX.COM >wrote in message
Quote
OpenDialog->InitialDir
That won't work while the dialog is already open. InitialDir is only
processed when Execute() is first called.
Gambit
 

Re:change current directory in TOpenDialog

"Stephan" <ask me @ kilroy.wuz.here>wrote in message
Quote
what do I need to do to change the folder displayed
in the OpenDialog when I change the file type?
The dialog box does not support what you are asking for. You can only set
the initial folder when the dialog is first opened, but not the current
folder while the dialog is still active. If you want that functionality,
then you will have to implement your own dialog manually.
Gambit
 

Re:change current directory in TOpenDialog

Okay,
thanks Remy