Re: Processing show signal



Esteban Quijano Vincenzi <equijano videotek tv> writes:
> I tried to make a hook function that is connected to the show event of a
> widget.
> This function should evaluate an expression, and depending on its
> result, let the
> widget to be shown or not. However, no matter if I return TRUE or FALSE
> from the hook function, the widget will always be shown.

A "show" handler should not have any return value, it won't have an
effect. Try gtk_signal_emit_stop_by_name() instead.

Note that "show" is emitted when you call gtk_widget_show(), not when
the window comes onscreen (maybe you knew that, but people are often
confused about this).

> How do I know if a hook function connected with gtk_signal_connect(...),
> not
> gtk_signal_connect_after(...), will be called before the "standard"
> function for
> that event?

Signal, not event. It's important to realize that signal/event are
different concepts.

This and also the order of handler invocation are explained in my
book, http://developer.gnome.org/doc/GGAD/

> As I know, if a hook function returns FALSE -like when processing
> "delete-event"
> when closing a GTK program- it will make the default action to be taken.
> Is that true
> for all event handlers?

The return value from delete_event isn't changing whether the default
handler of the signal will be run; instead, the return value from the
entire signal emission is examined in gtkmain.c (not just your
handler, the whole emission, though usually there's only your one
handler so the emission returns what your handler does).

> By the way, what's the difference between "delete-event" and
> "destroy-event"?
> 

delete_event means the user requested that a toplevel window be
closed, destroy_event means a GdkWindow was destroyed
(gdk_window_destroy()). 

You rarely get destroy_event signals, because most widgets disconnect
themselves from their window before they destroy it, so no widget
"owns" the GdkWindow at destroy time.

But there's still a GdkEventDestroy (destroy event) in this case,
though no signal is emitted corresponding to it.

Confusing isn't it - I'd suggest not cluttering your mind with this
stuff unless you really need to know it. ;-)

Havoc




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