file path

nicole
nicole Member Posts: 25
hi everyone! i have a field in a form where user will need to input a directory path...or, the user can also click the assist button, then a window will pop out where he can select the path (similar to when you click a 'Save as' button in most applications, a window pops out from where the user select the path)...are there built-in functions for this?

thanks!...i hope someone can help :wink:

Comments

  • DenSter
    DenSter Member Posts: 8,307
    There is a common dialog codeunit that you can use for this. I don't know the number off the top of my head.
  • Lee_Durrant
    Lee_Durrant Member Posts: 16
    On the OnAssitEdit enter the following code....

    gstrFileName := gmdlCommonDialog.OpenFile('My Directory',
    '',
    0,
    '',
    goptAction::Save);
    IF gstrFileName <> '' THEN
    "My Directory" := gstrFileName;

    ...where gstrFielName is a text variable, goptAction is an option with the values "Open,Save", and gmdlCommonDialog is codeunit 412 (Common Dialog Management).
  • g_dreyer
    g_dreyer Member Posts: 123
    Just a note on the common dialog, the cancel button will not return "cancel" to your code (you need to modify it, and only then cancel button will return an ugly error).

    For example, if you use the "openfile" function to save a file, and you click cancel, the dialog will still return a path and filename(if it was filled in).

    If you want the openfile to raise an error when the user clicks cancel then add the following line...
    CommonDialogControl.CancelError := TRUE;
    ...but I did warn you, it's an ugly error, and you cannot customize it. :cry:

    regards,
    gus
  • markvandermeij
    markvandermeij Member Posts: 26
    Although this is sometime ago, I just wrote an external function for finding a directory and returning the directory name (full path).

    http://www.mibuso.com/dlinfo.asp?FileID=531
  • PrebenRasmussen
    PrebenRasmussen Member Posts: 137
    Actually, I just uploaded a Navision Form that I made some days ago, it does the trick WITHOUT relying on external products AT ALL.
    Have a check on the download page in a day or two when webmaster makes it ready.
  • Savatage
    Savatage Member Posts: 7,142
    Sounds Great, Can't Wait! 8)