3

In a Drawing Area of ggraphics in gWidgets changes the mouse cursor to "GDK_TCROSS",but i want the same mouse cursor of the gwindow "GDK_LEFT_PTR":

 library(gWidgets)
 library(gWidgetsRGtk2)
 library(RGtk2)
 options(guiToolkit = "RGtk2")
 w=gwindow("")
 g=ggraphics(cont=w,no_popup=T,do.rubber.banding = F)
 plot(x,y)
 c=gdkCursorNew("GDK_TOP_LEFT_ARROW")
 getToolkitWidget(g)$ModifyCursor(c)

  or

 gtkWidgetModifyCursor(getToolkitWidget(g),"GDK_TCROSS","GDK_LEFT_PTR")

but this not works

narteaga
  • 147
  • 2
  • 12

1 Answers1

1

gtkWidgetModifyCursor modifies the colors of the cursor. You need to set the cursor through gdkWindowSetCursor. For that you need to grab the window associated with the widget:

getToolkitWidget(g)$getWindow()$setCursor(c)
jverzani
  • 5,600
  • 2
  • 21
  • 17
  • Thanks, but when i change or i update the graphic in this area ggraphics, again leaves the default mouse cursor "GDK_TCROSS" – narteaga Jun 27 '13 at 16:08
  • Interesting. This also happens if you just use `RGtk2` and `cairoDevice` without `gWidgets`. I can only suggest looking to see if there is some event signalled when a plot is drawn and change the cursor each time this happens. – jverzani Jun 27 '13 at 17:31
  • Many Thanks, i'll do this way – narteaga Jun 27 '13 at 17:57