// cCmdLineSelector.pkg // By Sergey V. Natarov, Wil van Antwerpen // Use Windows.pkg Use cWorkSpaceHandlerEx.pkg Class cCmdLineSelector is a Button Procedure Construct_Object Forward Send Construct_Object Property Handle phoPathForm 0 Property String psFileDialogCaption "" Set Size to 13 50 Set Label to "Browse" End_Procedure Procedure OnClick String sVDFRoot Handle hoForm Integer hoDialog bOk String sCurrentFolder sFileName sDirSep sCaption Get phoPathForm to hoForm If (hoForm=0) Procedure_Return // Acceptor form not attached Get psFileDialogCaption to sCaption Move (psVdfRootDir(ghoWorkSpaceHandlerEx)) to sVDFRoot Move (Sysconf(SYSCONF_DIR_SEPARATOR)) to sDirSep Get Value of hoForm item 0 to sFileName Move (Trim(sFileName)) to sFileName If (Pos(sDirSep,sFileName) <> 0) Begin Move (Parse_Drive(sFileName)+Parse_Path(sFileName)+sDirSep) to sCurrentFolder End Move (oOpenDialog(Self)) to hoDialog If (hoDialog <> 0) Begin Set Dialog_Caption of hoDialog to sCaption Set Initial_Folder of hoDialog to sCurrentFolder Get Show_Dialog of hoDialog to bOk If bOk Begin Get File_Name of hoDialog to sFileName If (Uppercase(sFileName) contains Uppercase(sVDFRoot)) Begin Move (Right(sFileName, Length(sFileName)-Length(sVDFRoot))) to sFileName Move ("@VDFROOT@\" + sFileName) to sFileName End Set Value of hoForm item 0 to sFileName Set Item_Changed_State of hoForm item 0 to True If (Focus(Self) <> hoForm) Begin Send Activate to hoForm End End End End_Procedure End_Class