Hello Tim, You colleagues code should work fine. I don't quite know what you mean by "always stays activated"... certainly the button should sit in place until you exit Pro (unless there is a quit of the MB application somewhere else). However, here are some points:
1) It's normal to have the "includes" at the top of a MB source file and not within the main() sub. However, the current layout does work. 2) Adding a button to the "Tools" buttonpad is fine, but you may consider creating your own buttonpad. This is often neater than adding to a standard one. 3) In the code below, the description of the button is to "Zoom to 15'X30' quads!". This is a single action and so may be better suited to a regular pushbutton. If however, there was a natural on/off notion (like "Display quads!"), then a togglebutton is ideal. 4) In your button handler code (sub "coords" - a better name is a good idea), you will need to keep a global, or file scope, logical variable to store if the button is on or off, and flip it in sub coords. Unfortunately Pro/MB doesn't give any way of querying if a button is up or down, so this "shadow" variable method is used to track it. 5) Most of the buttons which "stay down" in Pro are in fact toolbuttons. This is effectively an active mode where mouse clicks and motions are passed to your own handler. I don't think it's suitable for your quad zooming feature, but it's a nice flexible feature. 6) I presume that the code below is just a snippet. You do of course need to declare sub main and coords at the top of your MB file, and provide the body for sub "coords". Regards, Warren Vick Europa Technologies Ltd. http://www.europa-tech.com -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rood, Timothy Sent: Friday, March 01, 2002 10:21 PM To: [EMAIL PROTECTED] Subject: MI-L Unstable Buttons I've received the following from a FEMA colleague. He asked that I forward it to the "L" for assistance. Here's his message and his code follows: Can you help me code a button to "always stay activated" like the other tool buttons in the tool menu? Here is my code. Currently it is visible for the duration of the program then is unloaded. thankx Joseph C. Toland GIS Coordinator DR-1361-WA FEMA Region X - GIS 425.482.3717 [EMAIL PROTECTED] Thanks, Tim Rood FEMA sub main() ' open program through a button. include "mapbasic.def" include "menu.def" include "icons.def" Alter ButtonPad "Tools" Add Separator togglebutton Icon MI_ICON_ODBC_MAPPABLE HelpMsg "Zoom to 15'X30' quads!" Calling coords enable uncheck Show end sub _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.
