Following the example xDemoFileSave (Form XDEMOF_9), I noticed that I can make it work if you have a button to Save in the screen, but not if you dont...
the actual error is this one:
Code: Select all
---------------------------
Fatal Error
---------------------------
Component : TEST5232
createfilesavedialog
Statement : 24
Message : Windows error - stay on top forms require a main form.
Routine : File LpVoDlg at line 108.
---------------------------
OK
---------------------------
but if you have a save button and call this routine from the click on the button, it works fine. No idea what is the reason behind it, but in this way, works fine.
Notice that the Dialog is just a dialog to select the folder and filename that you are going to use to save it. basically it returns to you a path with a filename. No storage of any kind is performed.
For the #FileSave.Show, you can do whatever you want to save the image. In this case, as is a blob field, when you access it in your program it will put the blob content in a file in a temporary directory inside your installation. If you want to move it to the location selected, use the OV_FILE_SERVICE to copy it from the temporary directory to the new location.
Code: Select all
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Theme(#SYS_THEME<2015Blue>) ClientWidth(551) ClientHeight(301) Left(612) Top(207) Width(567)
Define_Com Class(#PRIM_PHBN) Name(#Save) Caption('Save') DisplayPosition(1) Left(416) Parent(#COM_OWNER) TabPosition(1) Top(264) Width(129)
Evtroutine Handling(#Save.Click)
#Com_owner.Save
Endroutine
Mthroutine Name(Save)
Define_Com Class(#Prim_appl.ICommonDialogFileSave) Name(#FileSave) Reference(*DYNAMIC)
Fetch Fields(#xEmployeeImage) From_File(xEmployeeImages) With_Key(100066)
#FileSave <= #sys_appln.CreateFileSaveDialog
#FileSave.File := #xEmployeeImage.FileName
If (#FileSave.Show)
Use Builtin(OV_FILE_SERVICE) With_Args("COPY_FILE" #xEmployeeImage.FileName #FileSave.File) To_Get(#IO$STS)
Endif
Endroutine
End_Com