Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well can we retrieve On or OFF state of toggle button. Do we have any property of toggle button that can be read from toggle button that is ON or OFF?

share|improve this question
up vote 1 down vote accepted

Unfortunately there is not way to detect the current state of a togglebutton. However if you create a matching menu item you can read the state of this and sop determine the state of the button.

That would of course also require that you in the handler for the button toggle the menu item as well as the button. You could create a standard menu handler and a standard togglebutton handler that just picks up the ID of the menu item/button and then calls a shared procedure that does the real work.

Use CommandInfo() to figure out which menu item/button was pressed. And use MenuItemInfoByID() to determine the current state of the menu item (and so the button)

Another solution would be to have a variable in your application that you can test to see whether the state of the button is checked or unchecked.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.