Re: Howto change a cursor for Gtk::Window ?



Dear John,

thanks for the code snipped,
it was really helpful. I copied
it to my small sample windows application
and the ref_window "pointer" is null?:

12              window.set_default_size(800,600);
(gdb) n
16              Glib::RefPtr <Gdk::Window> ref_window;
(gdb) n
18              ref_window = window.get_window();
(gdb) n
20              Gdk::Cursor m_Cursor (Gdk::WATCH);
(gdb) p ref_window
$2 = {pCppObject_ = 0x0}
(gdb)

... and my application dies.
I guess I do need to do more, or I do something terribly wrong :-)
I moved the code into my window constructor but it did not help either.
Any idea ?

Karl


On Wed, Jun 11, 2008 at 7:38 PM, John Hobbs <john velvetcache org> wrote:
Following up on Paul's message, you usually have to get the parent
Gtk::Windows Gdk::Window.

This is what I use.

Glib::RefPtr <Gdk::Window> ref_window;

ref_window = get_window();
Gdk::Cursor m_Cursor (Gdk::WATCH);
ref_window->set_cursor(m_Cursor);
while (Gtk::Main::events_pending ())
   Gtk::Main::iteration ();

... do busy stuff ...

ref_window->set_cursor ();
while (Gtk::Main::events_pending ())
   Gtk::Main::iteration ();


Don't know if that's something you already had or not :-)

- John Hobbs


On Wed, Jun 11, 2008 at 10:06 AM, Paul Davis <paul linuxaudiosystems com> wrote:
>
> On Wed, 2008-06-11 at 14:41 +0200, Karl Schmitt wrote:
>> Hi,
>>
>> I am fairly new to gtkmm and GTK+.
>>
>> I have trouble figuring out how to change
>> the gtkmm Window cursor (Gtk::Window) ...
>>
>> However, I found out that I can change
>> the cursor of a Gdk::Window using
>> a Gdk::Cursor object. Is there something
>> similar for a Gtk::Window.
>>
>> By the way, what's the difference of a Gtk::Window
>> and a Gdk::Window?
>
> Gdk::Window is an abstraction around the low level window object offered
> by the backend GUI system (X11, Quartz/Cocoa, GDI, DirectFB and more).
>
> Gtk::Window is a fully-fledged widget representing a window.
>
> Some widgets have their own Gdk::Window, many do not. The ones that do
> not draw into the Gdk::Window of their parent (or its parent, etc).
>
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>



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