Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Define new constants
#1
Yesterday I experimented with 'def' to define my own constants.
I created a macro that contains my own constants called "_QM_CUSTOM_CONSTANTS_"
I replaced items in all my other macros that with items declared in "_QM_CUSTOM_CONSTANTS_"

The problem was that I got an error when running a macro I was working on, the constant was not recognized.
I got the macro working by opening "_QM_CUSTOM_CONSTANTS__" and pressing the 'compile' button "...prepares macro to run, but does not run..." (the declared constants went from black to yellow/green).
After that all the other macros works.

Is there a way to make every other macro I create automatically make correct use my: "_QM_CUSTOM_CONSTANTS_"
(without having to open "_QM_CUSTOM_CONSTANTS_" and press the compile button?).

I read in the helpfile 'def' section about:
...reference files and type libraries,... , but I still do know how to properly make use of: 'Always Add System' or 'Always Add These Shared Files'.
#2
Better let it be function, not macro. Then QM will recompile it when you change something in it and open other macro.
Call it from a function that runs when QM starts, for example from your function "init2", because it runs first, if exists.
Or add #compile "_QM_CUSTOM_CONSTANTS_" in function "init2" or in macros where the constants are used.
Or use it with ref, eg add ref CO "_QM_CUSTOM_CONSTANTS_" in function "init2". Then in macros can use CO.SelectFromPopupList.

The "Always add shared files" option is not related.
#3
Thank you very much!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)