Re: [gtk-list] Gtk--: Gtk_Dialog (refresh) troubles

On Tue, 4 Aug 1998 wrote:

> Hi,
> I'm trying to use Gtk_Dialog in GTK-- but am running into some problems.
> My dialog windows are classes which inherit Gtk_Dialog and simply add some
> buttons to Gtk_Dialog::action_area() and some input fields to
> Gtk_Dialog::vbox().
> Dialogs are created only once and then only shown and hidden on demand. At
> first glance everything works just fine, but of course, further testing
> revealed the following problem: When my program is running and once I open
> any dialog for the first time, everything is fine. However, once I have
> opened
> a dialog, any other dialog I try to open comes up blank (ie: not redrawn)
> accompanied by the following error message:
> > ** WARNING **: file gtkbutton.c: line 856 (gtk_button_add):
> > "GTK_IS_BUTTON (container)"

If I understand you correctly, I think you have the same problem I had. 
When you say dialogs are only created once, do you mean per-dialog (a new
object for every type of dialog you wish to make) or globally (everyone
writes in the same dialog object)? 

If you mean globally, then I have a slight hack which seems to work pretty
well (if not, you might be able to use it anyway).  The way I do it is
derive a class from Gtk_Dialog (called gcDialog) and have that contain a
static pointer to a gcDialog.  The static pointer is alloc'ed the first
time a dialog is created, and then for that and each subsequent call the
object is packed with whatever I need.  The difference is that when I'm
done with the dialog, I call dialog->stop(), which unpacks and deletes all
the child widgets.  Any other way I tried caused an empty black window to
be created every time after the first call (something to do with the C
object being deleted too early).  If you're interested, I could send you
my code privately (2 small files).  I don't want want to waste too much

While we're on the subject, does anyone know if the Gtk_Dialog bug ever
fixed (since 1.0.4)?  Of course, it's more than likely to be a problem
with my code.  My hack is the only way I could keep the dialog from
showing up black after the first call.

Matt Perry []

Stupidity got us into this mess -- why can't it get us out?

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