Say you have a menu item that you can check and uncheck. And you have a toolbar button for the same thing, that you can toggle between a pushed and not-pushed state. Of course they need to be in synch, either both checked/pushed or neither checked/pushed.
What I did was set them to the same state initially. Then I put code inside each control so that when one changes, the other changes, too. Is there a usual way to do this that's cleaner?
Also, this doesn't retain the state a user gives it after the application is closed, so that the next time the app is used, these two controls would keep whatever state was last chosen. How would that be done?
This is a curiosity question. I'm working my way through a book and don't need to do that yet. (Synching up the two controls' states wasn't required - or taught - either, just creating the toolbar toggle button.)
Thanks!
What I did was set them to the same state initially. Then I put code inside each control so that when one changes, the other changes, too. Is there a usual way to do this that's cleaner?
Also, this doesn't retain the state a user gives it after the application is closed, so that the next time the app is used, these two controls would keep whatever state was last chosen. How would that be done?
This is a curiosity question. I'm working my way through a book and don't need to do that yet. (Synching up the two controls' states wasn't required - or taught - either, just creating the toolbar toggle button.)
Thanks!