Monday, October 6, 2014

Browse folder for Classic and RTC

Hi,

Browse folder in classic version using automation


  • It is look like as below





















  • On Assist edit of trigger write the following code




ExpMgt_lCdu.SelectFolderClassic_gFnc("Export Directory");

  • SelectFolderClassic_gFnc - Function code












IF ISCLEAR(WindowsShell_lAut) THEN
  IF NOT CREATE(WindowsShell_lAut) THEN
    EXIT;

SelectedFolder_lAut := WindowsShell_lAut.BrowseForFolder(0,FolderName_vTxt,1,'');

IF NOT ISCLEAR(SelectedFolder_lAut) THEN BEGIN
  FolderItem_lAut := SelectedFolder_lAut.Self;
  IF FolderItem_lAut.Path <> '' THEN
    FolderName_vTxt := FolderItem_lAut.Path;
END;

  • Pass the parameter by pass by reference 




  • Following variable is created for automation object






Name
DataType
Subtype
Length
WindowsShell_lAut
Automation
'Microsoft Shell Controls And Automation'.Shell

SelectedFolder_lAut
Automation
'Microsoft Shell Controls And Automation'.Folder2

FolderItem_lAut
Automation
'Microsoft Shell Controls And Automation'.FolderItem


Done !!


Browse folder in RTC version using DotNet Variable:


  • It is look like


























  • Call the browse folder function from assite edit trigger on field in page




  • Write the following function
















FolderBrowser_lDnt := FolderBrowser_lDnt.FolderBrowserDialog();
FolderBrowser_lDnt.ShowNewFolderButton := TRUE;
FolderBrowser_lDnt.Description := Text000_gCtx;
FolderBrowser_lDnt.ShowDialog();
IF FolderBrowser_lDnt.SelectedPath <> '' THEN
  FolderName_vTxt := FolderBrowser_lDnt.SelectedPath;


  • Pass the folder path by reference





  • Create the following variable
















Name
DataType
Subtype
FolderBrowser_lDnt
DotNet
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Windows.Forms.FolderBrowserDialog

  • Create one Text Constant use in above code







Name
ConstValue
Text000_gCtx
Select a Folder...

Done !!

No comments:

Post a Comment