Hello,
I am trying to add assit button to select a folder in Navision. I search the forum and find the below download:
http://www.mibuso.com/dlinfo.asp?FileID=169
The download is great ! But in order to run that, I need to register the dll file. Since the download was on 2003/Jan, is there any new method for folder select in Navision 4.0 ?
Thanks
Comments
RIS Plus, LLC
Thank you for your reply.
But codeunit 412 - Common Dialog Management is for selecting a FILE. I want to select a folder.
Any idea ?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Then you create a rec variable of subtype 'File' and call your new form to retrieve the foldername from the File variable.
RIS Plus, LLC
WindowsShell Automation 'Microsoft Shell Controls And Automation'.Shell
SelectedFolder Automation 'Microsoft Shell Controls And Automation'.Folder2
FolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem
ActiveWindow Automation 'CSideWindowCheck'.WindowCheck
IF ISCLEAR(WindowsShell) THEN
IF NOT CREATE(WindowsShell) THEN
EXIT;
IF ISCLEAR(ActiveWindow) THEN
IF NOT CREATE(ActiveWindow) THEN
EXIT;
SelectedFolder := WindowsShell.BrowseForFolder(ActiveWindow.WindowHandle,FolderName,1,'');
IF NOT ISCLEAR(SelectedFolder) THEN BEGIN
FolderItem := SelectedFolder.Self;
FolderName := FolderItem.Path;
END;
This is not my code, This will work. Instead of active window you could just use 0.
How we solved it is by using the SelectDir function in Delphi. It does the same, but You only have run a function out of your own created DLL.
Name DataType Subtype Length
ActiveWindow Automation 'C/SIDE Utility Classes'.ActiveWindow
I've an older version of this script and there is no use of ActiveWindow:
(By the way, you can compress the function to simply three lines)
With ActiveWindow, it looks like this:
(The TextConst Text000 contains the title of the Dialog)
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
@Albertvh: Would be nice to have this COM Server It seems to be missing in my installation, too.
@Timo: The count of lines of code is not my Problem But if I use 0 instead of the window handle parameter, the folder selection window disapears suddenly when I move the mouse...
BTW: Greez from WZ Ravensburg
Any further suggestions?
(Attend to the correct folder - this zip-file is for german Windows Installations - You have to unzip it to %Program Dir%\CSideUtilities\)
Greez from Münster (Westphalia)
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
with the rootdirectory parameter ist a problem, because see only this path?
The Root Directory is to prevent the user from leaving a specified directory, e. g. all files must be inside a specified \\fileserver\navision\
So you can make sure that nobody selects a directory on its own HDD.
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
I tried to insert your code:
But I get the following error message:
I have no idea, why and where it is expecting an array. How do I fix this problem?
Thanks for any help
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
http://www.mibuso.com/forum/viewtopic.php?t=9329
I solved the problem with the error message:
The problem was, that it was inside the OnAssistEdit trigger, which is not expecting a return value. Thus, I cannot use
Yet another problem. The browse for folder functionality in the OnAssistEdit window now works with
However, the window with the folder structure opens out of focus, and even when I click on the window, it mostly blinks and goes out of focus again. I have to move overlapping windows away, maybe click 4-5 times, before the window with the folder browser stays in place.
I don't know if it is because I'm not using the ActiveWindow automation:
'C/SIDE Utility Classes'.ActiveWindow or
'CSideWindowCheck'.WindowCheck
described earlier in this topic, but I'd rather not use these automations, if possible, because I fear that I may not always have access to it (since I e.g. haven't got it installed now (by default installation)).
Can the focus problem be solved (without the use of the (mentioned) ActiveWindow, preferably)?
I've another question about this solution. When I open the selection screen for selecting a folder, close the window by escape, then I get an error "... This instance variable could not be instantiated..."
This error occures in the code ".Items().Item.Path)", see below.
IF ISCLEAR(lAutShell) THEN
CREATE(lAutShell);
rTxtDirectory := FORMAT(lAutShell.BrowseForFolder(0,iTxtWhichDirectory,0).Items().Item.Path);
CLEAR(lAutShell);
When I remove this part I don't get this error, but also I do not get the directory anymore (only if the dir is in use).
Does somebody have an idea how to fix this? Why this error occures?
Thanx in advance.
Search the forum for "instantiated"
http://www.mibuso.com/forum/search.php
http://www.BiloBeauty.com
http://www.autismspeaks.org