I’m looking for an Automation Controller (with source code included would be nice!) which would allow me to browse my drives, select a directory and return the selected path as a string into Navision (ie: \SRV5\NAVIZIP\SALES) Has anyone got this in their toolbox ? ###### tarek_demiati@ureach.com
Please try this : (a) Add a variable named DlgTest and set it to OCX with the file name C:\WINNT\System32\COMDLG32.OCX (b) Write the following code in a button : DlgTest.ShowOpen; MESSAGE(DlgTest.FileName); Hope they help.
Thanks but it’s not what I was after : COMDLG32.OCX allows you to select a File not a Folder. What I need is to allow my users to select a folder in their directory without displaying the files in each folders. ###### tarek_demiati@ureach.com
Create a form from table 2000000022 (File), filtered by “Is a File” = false
In the web www.navisioner.com there is a form sample using virtual table “file” in C/AL code (A reduced version of Windows Explorer style ). It’s an sample really easy to understand. Maybe useful for you! Rafa Edited by - rafa_marius on 2002 Jul 08 09:18:05
Agustin : That’s the easy bit, the pain in the ass is designing the Form which allows you to select a Folder in a hierarchical maner as explorer does and I really dont want to spend too much time on that But if someone has got a form like this : http://www.navisioner.com/images/treeview.gif Which has the File table as the SourceTable then I’m taker Edited by - Tarek Demiati on 2002 Jul 08 09:19:22
Opppppppps! Derek had the same idea!
Rafa : I know how the File table works but I was after something which had a REAL Windows feel. http://www.navision.net/forum/topic.asp?TOPIC_ID=1804&FORUM_ID=9&CAT_ID=3&Topic_Title=File+Dialog&Forum_Title=Attain%2FFinancials+-+Developer+Forum I’m just trying to be nice for my users, if it would have just been for my own use the File table would habe been good enough. ###### tarek_demiati@ureach.com
S.K. Chong: I tried to use your OCX control but I receive a message saying that I haven’t licens to use this. It requires a “design time licens”. It also says that the licens cannot be obtained and that I should control my installation. But to my knowledge I have a standard installation(Win2000+Attain3.10). Anyone seen this problem before? Best regards Daniel
You need the C/OCX granule in your license if you want to design solution which uses OCX components ###### tarek_demiati@ureach.com
We have granul 1750 C/OCX in our licensfile. Daniel
Report this problem to Navision directly then, your license might not be configured properly. I had a similar problem a while back ###### tarek_demiati@ureach.com
OK. I will do that. Thanks for your help! /Daniel
I also believe you need a design time license from Microsoft. I sometimes forget this because i usually have some MS programming language loaded on my machine. if you don’t you get this same error regards
cvashellapp = automation = ‘Microsoft Shell Controls And Automation’.Shell cvashellfolder= automation=‘Microsoft Shell Controls And Automation’.Folder CREATE(cvaShellApp); cvaShellFolder := cvaShellApp.BrowseForFolder(0, ‘choose folder’, 0); cvFolderPath := cvaShellFolder.Title() this works the challenge is that the window doesn’t come up on top of the navision window but if you minimize navision there it is. This was with an ealier version of the Windows scripting language . the very newest may handle this. MS windows scropting language is a free download from windows. regards
Hi Has someone managed to use the previous selection folder sample with the window showing up in front of the Financials/Attain one?
I missed this one the first time around. The best I found was a bit of a hack, but it seems to work. Basically, I just used the Navision Common Dialog OCX and just made the user think they were picking a Folder. The code is something like (I stole this from something I did, so there are field names, etc. But the idea is there): FileDialog.DialogTitle := ‘Select Export Directory’; FileDialog.InitDir := “Export File Path”; FileDialog.Filter := ‘Directories|.’; FileDialog.FileName := ‘Choose Directory’; FileDialog.Flags := 4; FileDialog.ShowOpen; IF FileDialog.FileName = ‘Choose Directory’ THEN EXIT; LastPos := 0; FOR Index := 1 TO STRLEN(FileDialog.FileName) DO IF FileDialog.FileName[Index] = ‘’ THEN LastPos := Index; IF LastPos <> 0 THEN “Export File Path” := COPYSTR(FileDialog.FileName,1,LastPos);
quote:
Originally posted by Toni Lou Has someone managed to use the previous selection folder sample with the window showing up in front of the Financials/Attain one?
Yes, I have as a matter of fact. I will publish my solution here in the near future.
Hi Daniel, You can use the codeunit 412 (Common Dialog Management) to open the file selection dialog window.
quote:
Originally posted by jhoek I will publish my solution here in the near future.
As promised, here’s how I’ve manage to get the Browse for Folder dialog to sit on top of the Navision Attain application window, until the user selects a folder and presses OK, or cancels the folder selection. As you will probably have found, the BrowseForFolder method of the Shell object expects a window handle as its first parameter. The window that this handle refers to is to be parent window for the dialog that is displayed. This means that we need to find out the window handle for the Navision Attain application window. I assumed that, when the Browse for Folder dialog is activated, Navision Attain would always be the active application, so what we need is the window handle for the foreground application, which is something the Windows API can perfectly well supply us with. But how do we get this information from C/SIDE? For this purpose I’ve written what must be the tiniest OLE server ever: it contains only one class (ActiveWindow) which in turn supports only one property (Handle). This property returns the window handle for the foreground application, which can be passed to BrowseForFolder. Since I can’t seem to post my OLE server DLL in the Downloads section of this site, I will e-mail it to site members on request.