Changing the cursor



Hi,

I was able to set a transparent cursor using a transparent mask:

void TestWindow::on_realize(void) {
       // do standard realization dance
       Gtk::Window::on_realize();

       char data[] = { 0x00, 0x00, 0x00, 0x00 };
       Glib::RefPtr<Gdk::Bitmap> bmp = Gdk::Bitmap::create(data, 2, 2);
       Gdk::Color c;
       c.set_rgb_p(0, 0, 0);
       Gdk::Cursor cursor(bmp, bmp, c, c, 0, 0);

       // then change the cursor
       Glib::RefPtr<Gdk::Window> window = this->get_window();
       window->set_cursor(cursor);
}

It's all OK, but when i enter on a Gtk::Entry the cursor sets to the writing cursor (the '|' cursor) and it keeps like this for ever, so where must i put the code to change the cursor of a window? like it is, it seems to work just once.

Regards,
Deigo A. Fons.



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