Re: [gtk-list] Re: closing dialog in Gtk--




On 5 Mar 1998, Tero Pulkkinen wrote:
> 
> Hide the dialog and delete the C++ object. (and keep sure the object
> was not inserted to any container with add(), pack_start(), pack_end() or
> table_attach() :) But then, dialogs rarely are added to containers.
> 

Hmm. Perhaps I'm doing something else wrong. Is this test case correct
code?

#include <gtk--.h>

void close_callback ( Gtk_Dialog * gd )
{
  gd->hide();
  delete gd;
}


main(int argc, char ** argv)
{
  Gtk_Main m(&argc, &argv);
  Gtk_Dialog * gd = new Gtk_Dialog();
  Gtk_Button * b = new Gtk_Button("Close");

  gd->action_area()->add(b);

  b->show();
  gd->show();

  connect ( b->clicked,
	    close_callback,
	    gd );

  m.run();
}

I think I may be confused about connect() and all its combinations of
possible arguments.

Thanks,
 Havoc Pennington




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