// // CUSTDEMO.VDM Ch.Ziemski 10.11.2002 // 17.11.2002 // // Demo for CUSTOMIZE.VDM // // The macro should be nearly self-explanatory. ;-) // // //------------------------------------------------------------------------- // // Sample text register usage: // // 90 : name of this macro for further use // 91 : my favourite editor // 92 : my hometown // 93 : whatever // 94 : whatever // 99 : temp. // // Sample numeric register usage: // // #80 : for DI_1() // // #91 : my age // #92 : the answer = 42 // #93 : whatever // // //------------------------------------------------------------------------- // // Sample configuration section: // // //>>CONFIG-BEGIN---------- Attention: Avoid trailing spaces in this section! --- // // // -- The config value MYNAME contains the name of this macro itself. // -- Please change it manually here if you rename the macro file. // -- It's mandantory when using this functionality!! // // MYNAME: CUSTDEMO.VDM // // -- The following parameters are freely usable for the user. // -- (The names are examples only, of course.) // -- // // FAVEDITOR: VEDIT-Plus // HOMETOWN: Dortmund // TEXTVAR3: three // TEXTVAR4: four // MYAGE: 38 // THEANSWER: 42 // NUMVAR3: 123 // //>>CONFIG-END------------------------------------------------------------- if( ! Is_Win32_Version){ Get_Key("Sorry, but this macro only runs with the Win32-version of VEDIT!") return } //-------- Read the config parameters out of the macro ------------------- // The syntax of the following list is (per line): // // $ is the target text register for the variable named later // # is the target numeric register for the variable named later // = divider // name of the variable // = divider // optional default value if variable is empty in the config section // // // MYNAME doesn't have to be in this parameter list. // Only if you want to have the name stored in a register for further usage in your macro. // (Here it is used to be shown in the main dialog.) // // Note: "MYNAME" MUST NOT be in the DIALOG, DIALOG+SAVE or SAVE list! // //------- Reg_Set(104, " $90=MYNAME= $91=FAVEDITOR=notepad $92=HOMETOWN=here $93=TEXTVAR3=text3 $94=TEXTVAR4=text4 #91=MYAGE=18 #92=THEANSWER=0 #93=NUMVAR3=0 ") #104=Macro_Num Reg_Set(103, "READCONFIG") Call_File(101, "CUSTOMIZE.VDM", EXTRA) //-------- show the main dialog ------------------------ // // Here you would have your real macro functionality. // This demo simply has a main dialog to show some variables. // // Your real macro may/can/will change some registers while running. // Then you can save them like in the example at the end of this macro. // // Or somewhere you can call a dialog with the customize button(s) or // a direct call of the customize macro. // while(1==1){ Num_Str(#92, 99) // convert numerical variable to string for displaying #80=Dialog_Input_1(5,"`|@(90)`, `This is a little demo application for Customizing macros.`, `My favourite editor is: |@(91)`, `It's the answer for all like |@(99)`, `[&OK]`,`[Customize&1]`,`[Customize&2]`", APP+CENTER,0,0) if(#80 < 2){ break // quit the macro via or [OK] } if(#80 == 2){ CALL("CUSTOMIZE1") } if(#80 == 3){ CALL("CUSTOMIZE2") } } return //====== here are some dialog calls (incl. save calls) =================== //-------- Create and show a customizing dialog, save the changes -------- :CUSTOMIZE1: // The following parameter list can contain max. 5 entries. // Only the first 5 lines are evaluated/used due to limitations in the customizing dialog. // // If you wish you can try to format the input boxes via trailing spaces here // (see example below: the colons show the end of formatting spaces). Reg_Set(104, " $91=FAVEDITOR=My favourite editor : $93=TEXTVAR3=text variable 3 : $94=TEXTVAR4=text variable 4 : #93=NUMVAR3=A value : ") #104=Macro_Num Reg_Set(103, "DIALOG+SAVE") Call_File(101, "CUSTOMIZE.VDM", EXTRA) return //--------------------------------------------------------------------------- :CUSTOMIZE2: // Another very simple example: Reg_Set(104, " #92=THEANSWER=You know the answer : ") #104=Macro_Num Reg_Set(103, "DIALOG+SAVE") Call_File(101, "CUSTOMIZE.VDM", EXTRA) return //=========================================================================== //------- Or another alternative with separate dialog and save -------------- // // Or you can change some of those registers in the macro by yourself and // only use SAVECONFIG like below... // :CUSTOMIZE-OLD: Reg_Set(104, " #92=THEANSWER=The answer for everything : ") #104=Macro_Num Reg_Set(103, "DIALOG") Call_File(101, "CUSTOMIZE.VDM", EXTRA) if(Return_Value != 0){ // if canceled or no success: don't save values return } //-------- Save the config changes to the macro ------- // this list should contain the same items as the dialog's one ... Reg_Set(104, " #92=THEANSWER ") #104=Macro_Num Reg_Set(103, "SAVECONFIG") Call_File(101, "CUSTOMIZE.VDM", EXTRA) return //--------------------------------------------------------------------------