Re: broadcast signals?



On Mon, 21 Aug 2000, Richard Harvey Chapman wrote:

> I have an app that is a configuration tool for a list of machines.  I need
> a way to tell a set of widgets to update their values when a user clicks
> on a new machine in the list.  I figured signals were the way to go.
> Basically, I'd have each of the widgets "listen" for a certain "update"
> signal.
> 
> Throwing one more bit of complexity into it, I'd like to do it in sets.
> I'm not sure if that requires multiple signals or not.
> 
> Background: CTree with a list of machines. Notebook (~10 pages) with all
> of the configuration information.  I'd like to be able to update the
> current page first.  So, if page 3 was up, and a new machine was selected,
> I'd like to update page 3's widgets first to reduce noticable delay.
> 
> Is there a good way of doing this?

  It's definitely impossible with signals, but you can do that with events
easily. You have to connect handler for "client-event" to all widgets, then
create the event, and then use 'gtk_container_foreach' to iterate over all
children of container (in your case, you'll have to call gtk_container_foreach
for each page of notebook, current page first). The callback for
gtk_container_foreach should check whether the child is container too, and
call gtk_container_foreach for it if yes. After that the callback should call 
gtk_widget_event with that composed event (thus emitting "client-event"
signal).
 
> R.

 Best regards,
  -Vlad






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]