Image overlay

Hi all,

I’m making a RubyGtk application. I wanted to popup a customized modal
dialog to display an error message, or a confirmation to the user. The
application will be run in a touchscreen monitor, and will always be
displayed in fullscreen at a fixed resolution of 1024x768pixels. I
wanted to
put a slightly transparent background behind the dialog. The effect is
similar to those JavaScript Lightbox libraries, like Thickbox (
http://jquery.com/demo/thickbox/), or Lightbox (
http://www.huddletogether.com/projects/lightbox/).

I’ve managed to do it using a Gtk::Fixed container with elements, in
which
I’ve added a Gtk::Image, in (0,0) position to the fixed container before
displaying the dialog (and removed the image after the dialog returns).
The
image has 1024x768, so it covers the entire main window.

It worked out with most widgets, but there are some that stays in front
of
the Gtk::Image. Gtk::Label and Gtk::Button stayed behind the image, but
Gtk::Entry and Gtk::ProgressBar stayed in front of the image.

Is there a better way to create this effect? What could have caused the
issue with Gtk::Entry and Gtk::ProgressBar?

The ‘gksu’ creates an overlay over the entire screen. Is it possible to
do
something like this with RubyGtk?

Thanks
Escudero

I don’t really know the answer since I’ve never done it before,
but I’m guessing that sticking a Gtk::Fixed in your base window
means that you will have basically random z-order with your
widgets. I’ve tried doing other things that played with
z-order of widgets before and I could never get it to do
anything that I considered sensible :wink:

Instead, I would create a popup window the size of the screen
with position set to POS_NONE. You can then move the
window to 0,0 before you do a show_all. However, I can’t
remember if you can see through the window… If you can’t,
you should be able to copy the information from the
GDK window and redraw it with appropriate shading.

            MikeC

Mike C. wrote:

I don’t really know the answer since I’ve never done it before,
but I’m guessing that sticking a Gtk::Fixed in your base window
means that you will have basically random z-order with your
widgets. I’ve tried doing other things that played with
z-order of widgets before and I could never get it to do
anything that I considered sensible :wink:

Instead, I would create a popup window the size of the screen
with position set to POS_NONE. You can then move the
window to 0,0 before you do a show_all. However, I can’t
remember if you can see through the window… If you can’t,
you should be able to copy the information from the
GDK window and redraw it with appropriate shading.

            MikeC

Hmm I am not sure if transparency is possible with this. Anyone able to
ask a Gtk developer about it? I mean, setting a window transparent, or
half transparent, including z-ordering them, should be easy in the year
2008. :slight_smile:

but i never saw anything like it on gtk apps.
how about using the composite X capabilities?

I also did not see this in a GTK app yet.

But let’s be provocative and claim that GTK does not support this.

Maybe people can respond to this. :>

what i was looking for to implement in my apps is a transparency
existing in i guess qt, i saw it in skype while loading the old history.
the chat window is visible in the skype window, but it’s overlayed with
a semitransparent coat, and a progress shows up on top of it, which is
not transparent. i’t cool, but i never saw anything like it on gtk apps.
how about using the composite X capabilities?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs