[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 19 08:55:56 1993 
Subject:changing background colour of an rc_graphic window 
From:"A.Sloman" 
Volume-ID:931119.01 

Does anyone know how to change bacground colour of rc_graphic window?

XpwSetColor can be used to change the foreground colour (as shown in
TEACH RC_GRAPHIC), but I have found no way to change the background
colour (except within the new GO (Graphical Objects) package, which is
not generally available yet).

You can also change the foreground colour of the rc_graphic window by
doing, for example

'red' -> rc_window("foreground");   ;;; NOT in TEACH RC_GRAPHIC!

But this doesn't work, alas

'pink' -> rc_window("background");

There must be a way surely? I tried this code, based on stuff in
GO but it did not work either.

define rc_set_bgcolour(colourstring, widget);
    lvars colourstring, widget, colournumber, widget, oldcolour;

    ;;; remember original colour
    XptValue(widget, XtN foreground) -> oldcolour;

    ;;; find the new integer colour number
    colourstring -> widget("foreground");
    XptValue(widget, XtN foreground) -> colournumber;

    ;;; reinstate old fg colour
    oldcolour -> XptValue(widget, XtN foreground);
    ;;; set new background
    colournumber -> XptValue( widget, XtN background );
enddefine;


/*
;;; test it
lib rc_graphic;

rc_start();

rc_set_bgcolour('green', rc_window);

;;; doesn't work
*/

Any ideas welcome.
Aaron