Passing the workspace as a parameter: Difference between revisions
Passing the workspace as a parameter (view source)
Revision as of 12:45, 25 March 2020
, 25 March 2020Added to Tutorials category
(New page: ===Parameter to choose workspace used=== Previously in VDF 11.1 I have created and compiled programs on my development machine with local data on drive C:and a workspace called "Garments...) |
Hsymington (talk | contribs) m (Added to Tutorials category) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 21: | Line 21: | ||
If you want to use your old .ws file, just change the value of that particular property. | If you want to use your old .ws file, just change the value of that particular property. | ||
=== | ===An Example of a program that uses a subclass of cApplication=== | ||
the program: | the program: | ||
<source lang="vdf"> | |||
//AB-StoreStart | //AB-StoreStart | ||
Use dfAllEnt.pkg | Use dfAllEnt.pkg | ||
use DFAbout | use DFAbout | ||
// | |||
#REPLACE CURRENT$WORKSPACE "Training.Mapps121" //default - modified by calling param | #REPLACE CURRENT$WORKSPACE "Training.Mapps121" //default - modified by calling param | ||
Register_Object oClientArea | Register_Object oClientArea | ||
// | |||
// 1) use package for application workspace | // 1) use package for application workspace | ||
Use MyApplication.pkg //Workspc for multico workspace mapps121 | Use MyApplication.pkg //Workspc for multico workspace mapps121 | ||
// | |||
// 2) Set date attributes as needed | // 2) Set date attributes as needed | ||
Set_Date_Attribute sysdate4_State to dftrue | Set_Date_Attribute sysdate4_State to dftrue | ||
Set_Date_Attribute Date4_State to dftrue | Set_Date_Attribute Date4_State to dftrue | ||
Set_Date_Attribute epoch_value to 60 | Set_Date_Attribute epoch_value to 60 | ||
// | |||
// 3) Application Workspace - help type and name | // 3) Application Workspace - help type and name | ||
Object oApplication is a cMyApplication | Object oApplication is a cMyApplication | ||
End_Object // oApplication | End_Object // oApplication | ||
//etc | |||
</source> | |||
===The cApplication subclass=== | ===The cApplication subclass=== | ||
<source lang="vdf"> | |||
Class MyApplication is a cApplication | Class MyApplication is a cApplication | ||
Procedure OnCreate | Procedure OnCreate | ||
String sCompanyFolder stemp Programname | String sCompanyFolder stemp Programname | ||
cmdline sCompanyFolder | |||
cmdline sCompanyFolder // get a parameter from the command line! | |||
If (sCompanyFolder="") Move "TRAINING" to scompanyfolder //default to traing db if execeuted without param | If (sCompanyFolder="") Move "TRAINING" to scompanyfolder //default to traing db if execeuted without param | ||
move (uppercase(sCompanyFolder)) to sCompanyFolder | move (uppercase(sCompanyFolder)) to sCompanyFolder | ||
Send DoOpenWorkspace (sCompanyFolder -".mApps121") //CURRENT$WORKSPACE | Send DoOpenWorkspace (sCompanyFolder -".mApps121") //CURRENT$WORKSPACE | ||
Get_Attribute DF_OPEN_PATH to sTemp | Get_Attribute DF_OPEN_PATH to sTemp | ||
// | |||
//we use a file, REFNUM2, to contain info specific to this company | |||
Open refnum2 | |||
Move (trim(refnumA2("COMPFOLD"))) to sTemp //function to get a param from the company control file | |||
If (sTemp<>sCompanyFolder) Begin | If (sTemp<>sCompanyFolder) Begin | ||
Send stop_box ("Company ID mismatch in refnum2 file" * sCompanyFolder * sTemp) | Send stop_box ("Company ID mismatch in refnum2 file" * sCompanyFolder * sTemp) | ||
Abort //showstopper | Abort //showstopper | ||
End | End | ||
Set psCompanyFolder to sCompanyFolder | Set psCompanyFolder to sCompanyFolder | ||
//colour for visual clues | |||
Move (trim(refnumA2("COMPCOLR"))) to sTemp | Move (trim(refnumA2("COMPCOLR"))) to sTemp | ||
Set psCompanyColour to sTemp | Set psCompanyColour to sTemp | ||
//Formal Company Name | |||
Move (trim(RefNumA2("COMPANY"))) to sTemp | Move (trim(RefNumA2("COMPANY"))) to sTemp | ||
Set psCompany to sTemp | Set psCompany to sTemp | ||
//and much much more, you get the picture | |||
//.... | |||
Set peHelpType to htHtmlHelp | Set peHelpType to htHtmlHelp | ||
// | |||
Set pbEnterKeyAsTabKey to True | Set pbEnterKeyAsTabKey to True | ||
Set psProduct to "KirkNet" | Set psProduct to "KirkNet" | ||
Line 83: | Line 90: | ||
End_Procedure | End_Procedure | ||
End_Class | End_Class | ||
</source> | |||
[[Category:How To]] | |||
[[Category:Tutorials]] |