Did you ever wish to be able to modify/customize your macro via dialog menu and save the changes permanently?
As you may know the original VEDIT macro COMPDIR.VDM saves it's configuration and the changes in itself.
I used that technique in my new FILEVERS.VDM too (see thread "File Version Generator (Multi-BAK :-)" here) and added a dialog for changing the values.
Now I developed a more flexible way for that purpose.
So it's no longer necessary to include that macro code in every macro again.
Just prepare one text register and call my CUSTOMIZE.VDM.
I attached an example CUSTDEMO.VDM as little demonstration.
Imagine it as your main macro with some functionality and one or more "Customize" buttons.
Here a little summary how to call the macro functions:
// First set up T-Reg 104 with the variable parts:
Reg_Set(104, "
$91=FAVEDITOR
#71=VERSION
")
// Then call one of the following functions:
//--- Read the config out of the macro's config section into the registers
//
#104=Macro_Num Reg_Set(103, "READCONFIG")
Call_File(101, "CUSTOMIZE.VDM", EXTRA)
//--- Save the registers into the macro's config section
//
#104=Macro_Num Reg_Set(103, "SAVECONFIG")
Call_File(101, "CUSTOMIZE.VDM", EXTRA)
//--- Automatically generate a dialog and let the user change values
//
#104=Macro_Num Reg_Set(103, "DIALOG")
Call_File(101, "CUSTOMIZE.VDM", EXTRA)
//--- Combined: Generate the dialog and save the registers to the config section
//
#104=Macro_Num Reg_Set(103, "DIALOG+SAVE")
Call_File(101, "CUSTOMIZE.VDM", EXTRA)
The setup register 104 can contain additional infos:
//--- For reading the config there can be optional default values:
Reg_Set(104, "
$91=FAVEDITOR=vedit
#71=VERSION=6
")
//---For creating the dialog there can be optional labels for every input box:
Reg_Set(104, "
$91=FAVEDITOR=My favourite editor:
#71=VERSION=Current version:
")
Hopefully the macro has enough comments in it to understand what to do.
If not: Simply come back to here! :-)
Christian
History:
--- 1st version: Nov. 11, 2002
--- New version: Nov. 13, 2002
--- New version: Nov. 17, 2002: Bugfixes, more comments
|
|