Re: [gtk-list] The GdkEventAny structure



>  	Hi. In a custom widget I've made, I'm trying to synchronize two
>  instances of that widget, that is, whatever the user does to one of the
>  widgets automatically happens to the other.
>  	The first approach I though of was to receive all relevant events
>  from one widget and send them to the other, by calling directly it's
>  handler (same function, but different widget argument) and passing it the
>  same event struct. That seemed to be the most easy solution, but has one
>  problem: the two widgets keep dispatching the same event to each other
>  forever.
>  	The second approach was to use the send_event member of the event
>  struct to tell wich of the events is fake, as gtk does (I think). The
>  problem is that gtk itself already sets this member to TRUE.

This is the wrong approach.  What you really want is a model/view
separation of your widget and your data model.

Define an object that holds your data, and then have it emit signals
when the data is modified.  The widgets that present a view onto that
data should catch those signals and update their visual representation
accordingly.

  Federico



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