Re: dialog close signal and hiding dialog...



On Tue, 2003-08-12 at 20:45, Matthew Weier OPhinney wrote:
What happens here, though, in terms of keeping the dialog shown? Hmmm...
thinking I may be using the wrong widget...

when you click any of the buttons (or the X) you'll come out of the run
call returning the appropriate response. you then can destroy or (in
your case) hide on the dialog:

$ret = $dialog->run;
if( $ret eq 'ok' )
{
        # save
}
else
{
        # revert/don't change
}
$dialog->hide;

it then hides and sits around waiting for the next time you call run.
and all the normal run magic happens. over and over to your heart's
content.

Indeed, I think I'm tackling it wrong, though I've got it working.

I'm actually translating a pygtk-based library (ROX-Lib2) to perl using
gtk2-perl, and I've noticed a *TON* of differences in how the pygtk API
works vs. the gtk2 C api -- which, I'm happy to report, gtk2-perl
follows very closely, making looking at the C api very worthwhile for
gtk2-perl programmers. 

muppet and myself made every attempt to behave as C does. the only
exceptions we made where for Perlishness, where Perl can't really do
what C did, or where Perl can do something that C couldn't that makes
life a lot easier.

Long and short of it, I think this is one area where the pygtk ->
gtk2-perl direct conversion isn't making sense. The window is a 'dialog'
in name only; in function, it's a very complex window with a lot of
signals being emitted. I think I'll probably change this to be a
GtkWindow with a GtkVBox once I get a few issues ironed out.

you are already using it as slightly special window. you should really
get rid of all of the signal stuff and do things as the example above.
most of the code in you're response handler is most likely what should
be after the call to run. it is intended for exactly what you seem to be
trying to do.

Thanks for your explanations of how the GtkDialog is supposed to work;
very informative, and I'll keep it in mind for the future!

-rm




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