Re: how to dismiss a widget and be able to call it back again



On Thu, 2008-01-17 at 09:41 +1000, mick wrote:
> I'm having trouble with dismissing my "help" and "about" windows in such a way 
> that I can re-open them.

> I currently use 
> on_help_destroy_event(...) { return FALSE; }
> and 
> on_help_close_clicked(...) { gtk_widget_hide(help) }

You're close; instead of these, do the hide() in a handler for
'delete-event'  and returning TRUE.

Delete is fired when the window is being removed due to user action
(clicking Ok or Cancel, or [x]ing the Dialog, or...). You already
figured out hide()ing rather than letting the Window be destroyed, but
you need to block the 'delete-event' or that's exactly what will happen.
Thus return TRUE so that it doesn't propagate further.

Hiding in a delete handler is a fairly common usage in GTK apps.

Of course, whatever code is raising the Dialog (or whatever) will need
to present() the Window to get it back on the screen the next time Help
is activated. 

AfC
Sydney

-- 
Andrew Frederick Cowie

We are an operations engineering consultancy focusing on strategy,
organizational architecture, systems review, and change management
procedures: enabling successful use of open source in mission
critical enterprises, worldwide.

http://www.operationaldynamics.com/

Sydney   New York   Toronto   London

Attachment: signature.asc
Description: This is a digitally signed message part



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