Re: non-blocking delay in dialog emulation subclass



On Wed, 16 Jul 2008 14:43:53 -0400 (EDT)
"muppet" <scott asofyet org> wrote:

Okay, several comments:

- Why are you reinventing Gtk2::Dialog?
- Why are you reinventing Gtk2::ColorSelection?
- Why are you reinventing Gtk2::ColorSelectionDialog?
- Why are you using a canvas to get colored text?
 For the rgba?  Can a regular window have an rgba background?


If what you want is something that returns you a color string after user
interaction, you can have that with a trivial wrapper function in about ten
lines.

Well the idea is not just for color. I'm looking for a general purpose
popup that returns whatever I want, instead of integers(like a dialog).
I might want a textbox, or entries, etc.  


The trick is the recursive main loop, as you implemented in
non_blocking_delay().  gtk_dialog_run() uses that same pattern to wait for the
response signal on the dialog object.


In Perl/Tk, there is a waitVariable method, that will wait at that
point( non-blocking) until a variable changed. This is an attempt to
simulate that behavior.
Is this the best way to do this? Does Glib have something similar
to waitVariable?

Glib does not, but somebody posted to this very list rather a long time ago an
interesting experiment with tie() that got similar effects.


Anyways, I would appreciate any improvements. The way it works,
is during the Show() sub, the window will wait until a button
is pressed, then return a hex string if the button was Ok.
Bad or Good? :-)

What you've done is Bad.  You're using a recursive main loop to block control
flow without blocking the main loop --- that part is okay.  But don't use a
timer to wait for user interaction in your recursive main loop; connect
directly to the signal, even if you have to create your own signal to
decouple.

Hmmm, I don't get that part... I'll have to thinks. Ouch !!

Thanks
zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/CandyGram_for_Mongo.html 



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