Where should I put DIM gmstuff AS GLOBAL ?
Depending on the size of your project you probably will have a code module in your project. You can put Globals at the beginning of that module. Since I have often more than one code module in my projects I usually add a module with the name 'modGlobal' to project where I keep them.
Nevermind...
I didn't know I would have to DIM a global in every function... I thought once done that it was done.
You dont have to. You just define like this at the top of your code:
GLOBAL MYARRAY() AS LONG (OR WHATEVER TYPE)
Then at the entrance of your program do this
DIM MYARRAY(1 TO 100) AS GLOBAL LONG.
Then it will be global for any module, except threaded.
The trick is do do this before any module or submodule uses the array,
otherwise the program will crash.
Since you used DIM i assumed you were talking about arrays...
For simple variables its easier... just add this:
GLOBAL MyVar AS LONG
I put it in the FF_AppStart section...
Sometimes you just can't see the forest for the trees....
Quote from: James Padgett on November 19, 2010, 04:17:30 PM
I put it in the FF_AppStart section...
Where can I find FF_AppStart..?
Kind regards
In the FireFly Workspace - Special Functions section.
Got it, Rolf. Thanks!
Kind regards
Yeah, I usually put all of my globals in the FF_AppStart, or #Include a file containing the globals into FF_AppStart. It is easier than having them scattered throughout the project. You could also do as Rolf does (and I have also done in the past) and create a module specially to hold the globals (ie modGlobals.inc)