Hi Lars Thanks for the clarification. Just as I expected. The globals ARE defined in a .def file OK. I needed this as global as I refer to the legend window in another module.
Med venlig hilsen Terry -----Original Message----- From: Lars V. Nielsen (HVM) [mailto:[EMAIL PROTECTED] Sent: 08 July 2005 14:01 To: Terry McDonnell Subject: Re: MI-L Further to: Error trying to get Window ID - in defense of globals :-) I feel a need to clarify a few items here. > I would recommend not using global variables at all, and and many > cases this can also be avoided. Global variables do have a definite place in a modular MapBasic app. They're the only way to share common variable values application modules. But avoid putting them into module code itself. Define them in a DEF file, and include that instead. That way the definition is kept identical in all modules. > 2. Make sure you don't have a locale/modular variable with the same > name There are no syntax problems in having globals and dims with identical names in a module. But the Global override a module level Dim, i.e. Dim is ignored. However, routine level Dim's override Global's. The only serious problem is if globals are defined in library modules that you've downloaded from somewhere (i.e. don't have source code to recompile), and the names in the module clash with names in your app. But usually globals are a no-no in such library modules, but may be used nevertheless for their DDE/OLE capabilities. The work-around: try change the names in your app. Best regards / Med venlig hilsen Lars V. Nielsen --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 17058
