Re: Widgets inside a GtkDrawingArea



Sander Marechal wrote:
Hello,

I am writing a hearts game for GNOME using glade and the libglade XML loader. The main playing area is a big GtkDrawingArea. I need to add a button in the middle of the drawing area during the beginning of the game (when you are passing cards to another player). This button needs to disappear during the main play.

Is there a way to add a button inside (or on top) a GtkDrawingArea using glade? Or using Gtk directly in C? Glade wouldn't let me add one. If it isn't possible, is there an easy way I can "fake" the effect of a button sitting in the middle of the drawing area?

This is my first Gtk application (heck it's my first app since I moved away from the Win32 platform) so I'm not terribly experienced yet.
Hi,
You can't add a children widget to drawing area (it's not so easy, at least). Take a look at GtkLayout instead of GtkDrawingArea. This widget provides a window GtkLayout::bin_window that can be used for custom drawing like GtkDrawingArea and also it is a container like GtkFixed.

http://developer.gnome.org/doc/API/2.0/gtk/GtkLayout.html

        Olexiy



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