How do you retrieve the color from a GtkColorButton in rgtk2?

There seems to be a promising function gtkColorButtonGetColor

However, the function doesn't return the current color, instead it *sets* a
color that you pass to it.  The function header looks like
gtkColorButtonGetColor(color_button, color), and doesn't return anything.
That's a bit convoluted, but manageable.  I'll just create a "color", let
gtkColorButtonGetColor set it, and then read the modified value

However, you have to pass a *GdkColor* type to set "color"....  The simplest
way to create one seems to be:
color = as.GdkColor('white')

It seems I should be able to pass this color to the color button handler and
see what the selected color is.

HOWEVER, this still doesn't work.  gtkColorButtonGetColor still does not
modify the created color. >:(

require rgtk2
b<-gtkColorButtonNew()
gw <- gtkWindow(show=F)
gw$Add(b)
gw$Show()


changeColor<-function(b){
    color = as.GdkColor('white') # create a color to change
    message('initial color value')
    print(color)# print it out
    gtkColorButtonGetColor(b,color) # this function should change 'color'
    message('after gtkColorButtonGetColor()... on my machine the color is
unchanged:')
    print(color)
}

gSignalConnect(b, 'color-set',changeColor)


Best,
-Justin

-- 
Justin Donaldson
PhD Candidate, Informatics
Indiana University
http://www.scwn.net
aim: iujjd

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to