Select a folder in Navision

kenl
Member Posts: 182
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
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
0
Comments
-
-
Hello,
Thank you for your reply.
But codeunit 412 - Common Dialog Management is for selecting a FILE. I want to select a folder.
Any idea ?0 -
The functionality is in "shell32.dll" but no functions or properties are accessible in Navision... (it is OCX, but name is localized in my version of Windows - search in table 2000000042 for SHELL32) you can create some VB wrapper for this or may be that someone made it...0
-
I don't know how to make that work with any windows component. You could create a lookup form based on the virtual 'File' table though. Just use the form wizard and that will add an OK button for you. Set a filter on the "Is a file" field to where it is No, that should give you the folders only.
Then you create a rec variable of subtype 'File' and call your new form to retrieve the foldername from the File variable.0 -
Name DataType Subtype Length
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.0 -
Looks finde, but I don't have the 'CSideWindowCheck' automation server. Is there any other way to get Navision's Window handle?0
-
use this variable instead
Name DataType Subtype Length
ActiveWindow Automation 'C/SIDE Utility Classes'.ActiveWindow0 -
tomtror wrote:Looks finde, but I don't have the 'CSideWindowCheck' automation server. Is there any other way to get Navision's Window handle?
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)IF ISCLEAR(ShellControl) THEN CREATE(ShellControl); EXIT(FORMAT(ShellControl.BrowseForFolder(0,Text000,0).Items().Item.Path));
With ActiveWindow, it looks like this:IF ISCLEAR(ShellControl) THEN CREATE(ShellControl); IF ISCLEAR(ActiveWindow) THEN CREATE(ActiveWindow); EXIT(FORMAT(ShellControl.BrowseForFolder(ActiveWindow.WindowHandle,Text000,0).Items().Item.Path));
(The TextConst Text000 contains the title of the Dialog)Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Thanks Albertvh and Timo.
@Albertvh: Would be nice to have this COM ServerIt seems to be missing in my installation, too.
@Timo: The count of lines of code is not my ProblemBut 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?0 -
tomtror wrote:[...]
Would be nice to have this COM ServerIt seems to be missing in my installation, too.
[...]
(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)Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
how can i set a position in the tree.
with the rootdirectory parameter ist a problem, because see only this path?0 -
dgroeser wrote:how can i set a position in the tree.
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.Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Hi Timo,
I tried to insert your code:Timo Lässer wrote:(By the way, you can compress the function to simply three lines)IF ISCLEAR(ShellControl) THEN CREATE(ShellControl); EXIT(FORMAT(ShellControl.BrowseForFolder(0,Text000,0).Items().Item.Path));
But I get the following error message:Message Box wrote::= cannot be performed on arrays.
Choose a single array value using an expression such as:
MyArray[...]
I have no idea, why and where it is expecting an array. How do I fix this problem?
Thanks for any help0 -
Emerik wrote:Hi Timo,
I tried to insert your code:Timo Lässer wrote:(By the way, you can compress the function to simply three lines)IF ISCLEAR(ShellControl) THEN CREATE(ShellControl); EXIT(FORMAT(ShellControl.BrowseForFolder(0,Text000,0).Items().Item.Path));
But I get the following error::= cannot be performed on arrays. Choose a single array value using an expression such as: MyArray[...]
I have no idea, why and where it is expecting an array. How do I fix this problem?
Thanks for any help0 -
Do you make it right, it works too!0
-
Hi again,
I solved the problem with the error message:Message Box wrote::= cannot be performed on arrays.
Choose a single array value using an expression such as:
MyArray[...]
The problem was, that it was inside the OnAssistEdit trigger, which is not expecting a return value. Thus, I cannot useEXIT(...)
Yet another problem. The browse for folder functionality in the OnAssistEdit window now works withCLEAR(WindowsShell); CREATE(WindowsShell); "Import Directory" := FORMAT(WindowsShell.BrowseForFolder(0,TitleImport,1).Items().Item.Path);
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)?0 -
Hello,
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.0 -
your having trouble with the automation
Search the forum for "instantiated"
http://www.mibuso.com/forum/search.php0 -
well it's an easily breakable short version. the original version works great. thank you.0
-
well, you get a lot of errors trying to shorten things. this is better:
IF ISCLEAR(shellcontrol) THEN CREATE(shellcontrol); selectedfolder := shellcontrol.BrowseForFolder(0,text50000,0); IF NOT ISCLEAR(selectedfolder) THEN BEGIN folderitems := selectedfolder.Items(); IF NOT ISCLEAR(folderitems) THEN BEGIN folderitem := folderitems.Item(); folderitem2 := folderitems.Item(0); IF NOT ISCLEAR(folderitem) THEN BEGIN "directory Path" := folderitem.Path ; END ELSE IF ISCLEAR(folderitem) AND NOT ISCLEAR(folderitem2) THEN BEGIN //handle desktop "directory Path" := COPYSTR(folderitems.Item(0).Path, 0, STRLEN(folderitems.Item(0).Path) - STRLEN(folderitems.Item(0).Name)); END; END; END;
1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions