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
Hsymington (talk | contribs) m (Added to Tutorials category) |
|||
(7 intermediate revisions by 3 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 | ||
Line 42: | Line 43: | ||
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 | ||
Line 50: | Line 54: | ||
cmdline sCompanyFolder // get a parameter from the command line! | 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 | Open refnum2 | ||
Move (trim(refnumA2("COMPFOLD"))) to sTemp //function to get a param | 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 | ||
// | // | ||
Line 85: | Line 90: | ||
End_Procedure | End_Procedure | ||
End_Class | End_Class | ||
</source> | |||
[[Category:How To]] | |||
[[Category:Tutorials]] |