OpenFileDialog does not appear

I’m using XOJO Version 2022 Relaese 1.1 and try to get older apps working with Monterey.
Until now I’m stuck with this part:

Var dialog As OpenFileDialog
dialog = New OpenFileDialog
dialog.Filter = FileTypen.VideoMP4
dialog.PromptText = “Das mp4-Video aussuchen.”
dialog.Title = “Bitte das Video öffnen”
dialog.Left = 50
dialog.Top = 50
dialog.ActionButtonCaption = “OK”
dialog.CancelButtonCaption = “Abbruch”

If Pfad_zur_Filmdatei="" then

App.FI_Video_Movie=dialog.ShowModal

  • if App.FI_Video_Movie<>Nil and App.FI_Video_Movie.exists then*
  • Videofenster.ThePlayer.movie=Movie.Open(App.FI_Video_Movie)*
  • end if*

App.Pfad_zur_Filmdatei=App.FI_Video_Movie.NativePath

End If

I get no errors but the dialog does’nt appear at all so that I can’t make a choice for opening a file.

What am I doing wrong?
Please give me a hint!

Monterey don’t ask you permission to access to the hard disk ?
If so and if you reject it, no dialog will be issued…

You have many ‘*’ and an End If that have to be removed… from your code above…

I do not know this construct:
App.FI_Video_Movie = dialog.ShowModal

Some variables are not declared in the above code…

At last, please, select the Xojo Code and press the
image
icon to let this forum software display it as Xojo Code.

This is the call which should show the dialog. It is inside a conditional statement. Have you put a breakpoint there to test whether the code actually gets there?

With this code:


Var Open_Dlg As New OpenFileDialog
Var FI_Video_Movie As FolderItem

Open_Dlg.Filter = "VideoMP4"
Open_Dlg.PromptText = "Das mp4-Video aussuchen."
Open_Dlg.Title = "Bitte das Video öffnen"
Open_Dlg.Left = 50
Open_Dlg.Top = 50
Open_Dlg.ActionButtonCaption = "OK"
Open_Dlg.CancelButtonCaption = "Abbruch"

'If Pfad_zur_Filmdatei = "" Then

FI_Video_Movie = Open_Dlg.ShowModal

If FI_Video_Movie<>Nil And FI_Video_Movie.exists Then
  MessageBox "Valid file Reference"
  'Videofenster.ThePlayer.movie=Movie.Open(App.FI_Video_Movie)
End If

'App.Pfad_zur_Filmdatei=App.FI_Video_Movie.NativePath

the OS ask:

and if accepted, shows the dialog:

Last released Monterey/M1.