0

How do I synchronize different radio buttons, on different windows, that means the same. Like:

Window A (main): radioButtonA1, radioButtonA2 (both in radioGroupA)

Window B (popup): radioButtonB1, radioButtonB2 (both in radioGroupB)

...where radioButtonA1 means the same that radioButtonB1, and radioButtonA2 means the same that radioButtonB2 (like of they were mirrored).

When I change the radio selections via itemStateChanged, I want also to synchronize the selection display. So if I change the selection in radioGroupA to radioButtonA2, I want that radioGroupB also changes it selection to radioButtonB2 (as they mean the same).

But I want that the event itemStateChanged on both radio buttons be called only once. If I tell radioButtonA2 itemStateChanged event to also adjust the selection of radioGroupB to radioButtonB2, then the radioButtonB2 itemStateChanged event will also be fired (or vice-versa), and I don't want that.

Independent, if I pressed radioButtonA2 or radioButtonB2, I want the display to be synchronized and then call the method i wrote to deal with the change. But only once, not twice. Any help?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1
    `Any help?` yes could be based on your code, for better help post an [SSCCE](http://sscce.org/), short runnable, compilable, just about a.m. issues – mKorbel Apr 17 '13 at 21:18

1 Answers1

0

I would go for sort of an MVC approach: you have 1 model object, which is represented by multiple views (in multiple windows in your case).

You could use something like this to be the model of your radiogroup.

Community
  • 1
  • 1
Vincent van der Weele
  • 12,927
  • 1
  • 33
  • 61