Board index » delphi » Changing OpenDialog multiselect options at runtime

Changing OpenDialog multiselect options at runtime

I want to change in the runtime the Multiselect option after the OpenDialog
is already created, based on the FilterIndex the user selects, i.e. if the
user selects filter for files of  type *.A then he the "multiselect" should
be on, and he if selects filter for files of  type *.B then it "multiselect"
should be off. It seems you can change the Options only before the
OpenDialog is created.

Thanks,

Michael

 

Re:Changing OpenDialog multiselect options at runtime


Quote
> I want to change in the runtime the Multiselect option after the OpenDialog
> is already created, based on the FilterIndex the user selects, i.e. if the
> user selects filter for files of  type *.A then he the "multiselect" should
> be on, and he if selects filter for files of  type *.B then it "multiselect"
> should be off. It seems you can change the Options only before the
> OpenDialog is created.

Have you tried the OnTypeChange event of the OpenDialog?

--
- Patrick Kolla

---------------------------------------------------
  All outgoing and incoming mail is being scanned
 by Norton Antivirus with current definition files
---------------------------------------------------

Re:Changing OpenDialog multiselect options at runtime


"Patrick M. Kolla" <patr...@kolla.de> wrote in message
news:3D04B5BD.9F262B31@kolla.de...

Quote
> Have you tried the OnTypeChange event of the OpenDialog?

Yes, but the way it's now, it doesn't do anything:

procedure TForm1.OpenDialog1TypeChange(Sender: TObject);
begin
  if TOpenDialog(Sender).FilterIndex = 1 then
    begin
      if not (ofAllowMultiSelect in TOpenDialog(Sender).Options) then
          TOpenDialog(Sender).Options := TOpenDialog(Sender).Options +
[ofAllowMultiSelect];
    end
  else
    begin
      if (ofAllowMultiSelect in TOpenDialog(Sender).Options) then
          TOpenDialog(Sender).Options := TOpenDialog(Sender).Options -
[ofAllowMultiSelect];
    end;
end;

Michael

Re:Changing OpenDialog multiselect options at runtime


Look into TOpenDialog.DoExecute in dialogs.pas. Seems like multiselect
option is handled via size of buffer for file names, if multiselect, it's
655320, otherwise MAX_PATH.
So, don't think you can do it with standard open dialog. But you can create
your own open dialog with FileCtrl (
TDirectoryListBox,TFilterComboBox,TDriveComboBox,TFileListBox,....).

--
Robert

Quote
Michael Beck wrote in message <3d04a99f_1@dnews>...
>I want to change in the runtime the Multiselect option after the OpenDialog
>is already created, based on the FilterIndex the user selects, i.e. if the
>user selects filter for files of  type *.A then he the "multiselect" should
>be on, and he if selects filter for files of  type *.B then it
"multiselect"
>should be off. It seems you can change the Options only before the
>OpenDialog is created.

>Thanks,

>Michael

Other Threads