Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2025-09

How to define the content of the left pane of TOpenDialog when used in Windows11?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

After upgrading my Windows-10 PC to Windows-11 my frequently used application to edit video files changed behaviour when using the function to select the file to work on. It was created some 6-7 years ago and has been modified several times during the time since then, last time in the beginning of this year using Lazarus 3.4.

It uses this TOpenDialog, which has been dropped on the main form when I designed the application:

dlgOpen: TOpenDialog;

And its customized propertis (in the lfm file) are:

  object dlgOpen: TOpenDialog
    DefaultExt = '.mp4'
    Filter = 'MP4 Video|*.mp4|MP3 Audio|*.mp3|Other media|*.*'
    Left = 24
    Top = 280
  end

Everything else are defaults.

The dialog is called like this:

procedure TfrmMain.btnOpenClick(Sender: TObject);
var
  VideoURL: Widestring;
  lastfile: string;
  lastvolume, lastpos: integer;
begin
  lastfile := ReadIniString('videofile', 'lastfile', '');
  lastvolume := ReadIniInt('videofile', 'lastvol', trkVolume.Position);
  lastpos := ReadIniInt('videofile', 'lastpos', 0);
  if lastfile  '' then
  begin
    dlgOpen.InitialDir := ExtractFileDir(lastfile);
    dlgOpen.FileName := ExtractFileName(lastfile);
  end;
  if dlgOpen.Execute then

At this point the dialog is shown to the user with the lastfile selected in the right hand pane.

The left hand pane is supposed to show the *parent directory* of the selected file so it is easy to navigate to another directory in the same video library main dir.
And this has always happened without me having to code anything...

Not so after the switch to Windows 11!
(I have not touched the exe file of the application during or after the Windows upgrade.)

Now the right hand pane shows the defined file selected in its directory with the other files listed too.
But the left hand pane shows the ** User's Desktop content **, which is totally irrelevant for the operation to select the next file to edit... It *should* show the folder content of the directory where the selected dir lives.

QUESTION:
---------
Is there some property or command I can use in order to define the directory to be shown inside the left hand window in code before I activate it?

As you see above I have used just the bare minimum of configuration of the dialog in the application.

Grateful for advice because I use this application maybe 10 times per day and it is really annoyiong to use it now.

Bo Berglund Developer in Sweden

Reply by email

Wayne Sherman
to Bo Berglund
Bo Berglund wrote 10 lines
After upgrading my Windows-10 PC to Windows-11 my frequently used application to edit video files changed behaviour when using the function to select the file to work on. The left hand pane is supposed to show the *parent directory* of the selected file so it is easy to navigate to another directory in the same video library main dir. And this has always happened without me having to code anything... QUESTION: Is there some property or command I can use in order to define the directory to be shown inside the left hand window in code before I activate it?

You might try the Win9x dialog using ofOldStyleDialog to see if it works more to your liking:

  dlgOpen.Options := dlgOpen.Options + [ofOldStyleDialog]

Not sure it is correct, but according to LLM:
1) "...with the modern (Vista/Win11) file-open dialog you can?t control the left pane. It?s the ?Places/Quick Access? navigation pane managed by the shell, not a live folder tree that follows your current folder. You can only choose the initial folder shown in the main (right) pane."

2) Setting FileName := '' when the remembered file no longer exists
helps some shell heuristics honor InitialDir more consistently.

3) Build your own picker UI. If you really want full control, use TShellTreeView + TShellListView (or similar) in your own form and mimic an ?Open? dialog. That lets you decide exactly what the left pane shows.

Reply by email

Bo Berglund
to Wayne Sherman
Wayne Sherman wrote 30 lines
Bo Berglund wrote: > After upgrading my Windows-10 PC to Windows-11 my frequently used application to > edit video files changed behaviour when using the function to select the file to > work on. > The left hand pane is supposed to show the *parent directory* of the selected > file so it is easy to navigate to another directory in the same video library > main dir. > And this has always happened without me having to code anything... > QUESTION: > Is there some property or command I can use in order to define the directory to > be shown inside the left hand window in code before I activate it? You might try the Win9x dialog using ofOldStyleDialog to see if it works more to your liking: dlgOpen.Options := dlgOpen.Options + [ofOldStyleDialog] Not sure it is correct, but according to LLM: 1) "...with the modern (Vista/Win11) file-open dialog you can?t control the left pane. It?s the ?Places/Quick Access? navigation pane managed by the shell, not a live folder tree that follows your current folder. You can only choose the initial folder shown in the main (right) pane." 2) Setting FileName := '' when the remembered file no longer exists helps some shell heuristics honor InitialDir more consistently. 3) Build your own picker UI. If you really want full control, use TShellTreeView + TShellListView (or similar) in your own form and mimic an ?Open? dialog. That lets you decide exactly what the left pane shows.

OK, that sounds like doing a workaround that might be rather involved because one might want to go hunting for a file that is in some distant location on disk. So the Explorer "exploration" must be available...

Then I have to implement a new dialog complete with some bells and whistles that might not be so obvious...
But it is good to know that Windows 11 is what is behind this too. :-(

I have had to spend this week writing a replacement for the QuickLaunch Toolbar that was available on Win 10 and which I use a lot to speed up starting applications I need. It has been actively blocked in Win 11...

So I have written a new application to put a bar on some screen location (configurable) and containng active shortcuts to my applications. It took a deal of work to do but I now have a replacement which holds the same shortcuts I had on my Win10 Quick Launch.
But it really sucks that one has to do this because Microsoft decided that it should not be available in an upgrade it forces on me by saying "no further updates after October 2025"....

Bo Berglund Developer in Sweden

Reply by email