Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Enumerating uielements (Read 2016 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Enumerating uielements

Is there a way to enumerate all the instances of an uielement?

I'd like to post a message to each instance when a particular parameter changes in the preferences page.


Re: Enumerating uielements

Reply #2
I know but the circumstances are not entirely the same.

Then I needed the single instance of a playback component talking to its partner-panel. Now I need to notify potentially multiple instances of a UI panel.

Thx anyway, I look at your solution again.

Re: Enumerating uielements

Reply #3
Not a direct answer to your question, but do you have to make it so complex? It's your component, you can communicate with all instances through any means, for example global variables.

Re: Enumerating uielements

Reply #4
Not a direct answer to your question, but do you have to make it so complex? It's your component, you can communicate with all instances through any means, for example global variables.
The design is as follows: a UIElement-derived panel, of which there can by more than 1 instance, and a Preferences page.

I was under the impression that, while the panel are separate instances, there is only 1 instance of the Preferences page.

Is this assumption right? And if so, how can a Preferences page be used to change the individual configuration of each panel instance?

I do not have this problem with foo_vis_spectrum_analyzer because each instance launches its own Configuration dialog.

Re: Enumerating uielements

Reply #5
The design is as follows: a UIElement-derived panel, of which there can by more than 1 instance

So that is exactly the same as what you asked for before. I even adapted the code you posted to make it fit. :/

Iterating the instance list can be done from anywhere. I was unsure at the time but range based loops do work.

Code: [Select]
for (auto&& instance : Notify::instanceList())
{
instance->do_something();
}

Preference pages have an apply method so that's where you'd call it from.

Re: Enumerating uielements

Reply #6
The design is as follows: a UIElement-derived panel, of which there can by more than 1 instance

So that is exactly the same as what you asked for before. I even adapted the code you posted to make it fit. :/

Iterating the instance list can be done from anywhere. I was unsure at the time but range based loops do work.

Code: [Select]
for (auto&& instance : Notify::instanceList())
{
instance->do_something();
}

Preference pages have an apply method so that's where you'd call it from.
No, it's not. But I already said I was going to look at your solution again.

Re: Enumerating uielements

Reply #7
@marc2k3 ,

works like a charm. Thx. again.