If you create a dialog (eg. OpenDialog) you get a Result, and you can use it, but you still have to declare a FolderItem and set that to the return of the Dialog.
Correct code from the LR
Var dlg As OpenFileDialog
Var f As FolderItem
dlg = New OpenFileDialog #If Not TargetLinux Then
dlg.InitialFolder = SpecialFolder.Documents #Else //open Home directory on linux
dlg.InitialFolder = SpecialFolder.Home #Endif
dlg.Title = "Select a Text file"
dlg.Filter = FileTypes1.Text // "text/plain" file type defined in FileTypes1 set
f = dlg.ShowModal
If f <> Nil Then
//proceed normally
Else
//User Cancelled
End If
Incorrect Code example
dlg.result = dlg.ShowModal
I have read the LR but can’t find a use for it, So Why is it there?
(P.S. Grumble. I cannot get it to completely mark stuff as code)
That statement is, as you pointed out, incorrect. The inner mysteries of the dialog are what actually assign the value to dlg.result, not you. You might have a variable with the name result (appropriately typed for the type of value the dialog returns). So, if your dialog returns a folderitem, the variable type for result must be Folderitem.