Re: Check Menu item and toolbar button out of sync
Fulvio Senore <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Il 17/09/2024 14:07, Vadim Zeitlin ha scritto: > On Tue, 17 Sep 2024 12:57:24 +0200 Fulvio Senore wrote: > > FS> I have a program with some menu entries (of course). Some of them are > FS> check items and one is replicated in a toolbar button that uses the same > FS> ID. I can mix menu clicks and toolbar button clicks and both elements > FS> stay in sync: if I check the menu item the button becomes pressed, for > FS> instance. > > This doesn't happen automatically, actually. Typically you'd use > wxEVT_UPDATE_UI handler to do it: as it will be called for both the menu > item and the toolbar tool (because they have the same ID), it would set > their states to the same value. Thank you! I wrote the existing working code about 10 years ago and I didn't remember absolutely anything about it. I was thinking that the connection was automatic but now I looked at the old code and there is a wxEVT_UPDATE_UI handler that does the trick. I wish I had asked for help a few days ago... Fulvio -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/a3e1e368-e91d-49f7-b0be-950135afeb18%40fsoft.it.