GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 23, 2014 5:55 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: changing or hiding mouse cursor
PostPosted: Thu Jul 21, 2011 5:38 am 
Offline
GTK+ Geek

Joined: Wed Mar 18, 2009 2:26 pm
Posts: 62
Hello all
I want to know how to either change the mouse cursor or hide it when it is over a particular widow in the example below.

compile using
gcc -Wall -g basic_window.c -o basic_window -export-dynamic `pkg-config --cflags --libs gtk+-2.0 `

Code:
#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
GtkWidget *Lwindow;


gint main (gint argc, gchar *argv[])
{

   gtk_init (&argc, &argv);


   Lwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (Lwindow), "WOnka Window");
   gtk_window_set_modal(GTK_WINDOW (Lwindow),TRUE);
   gtk_window_set_transient_for(GTK_WINDOW (Lwindow),NULL);
   gtk_window_set_position (GTK_WINDOW (Lwindow), GTK_WIN_POS_CENTER);
   gtk_container_set_border_width (GTK_CONTAINER (Lwindow), 1);
   gtk_widget_set_size_request (Lwindow, 750, 300);


   gtk_widget_show_all (Lwindow);
   gtk_main ();

   return 0;
}


Thank You

_________________
Hello, העלו, Здравствулте!


Top
 Profile  
 
 Post subject: Re: changing or hiding mouse cursor
PostPosted: Thu Jul 21, 2011 8:42 am 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello.

Have you even tried searching for any preexisting solution? Simply typing "changing cursor" in search field of this forum returns these results: do search for me.

Cheers,
Tadej


Top
 Profile  
 
 Post subject: Re: changing or hiding mouse cursor
PostPosted: Wed Jul 27, 2011 6:09 am 
Offline
GTK+ Geek

Joined: Wed Mar 18, 2009 2:26 pm
Posts: 62
Thank you!

_________________
Hello, העלו, Здравствулте!


Top
 Profile  
 
 Post subject: Re: changing or hiding mouse cursor
PostPosted: Fri Jan 27, 2012 4:25 am 
Offline
GTK+ Geek

Joined: Wed Mar 18, 2009 2:26 pm
Posts: 62
I managed to do it ....


Code:
      GdkCursor *cur;
      cur = gdk_cursor_new( GDK_BLANK_CURSOR );
      gdk_window_set_cursor (gtk_widget_get_window( GTK_WIDGET( Lwindow ) ), cur);
      gdk_cursor_unref( cur );


Thanks man!

_________________
Hello, העלו, Здравствулте!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group