[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3155.0. "Help for inverting colors in Label widgets..." by MLNAD0::POGLIANI (Ducunt fata volentem, nolentem trahunt) Wed Aug 01 1990 04:45

    Hi everybody,
    
    	I'm just a very new one in the DECW Programming.
    I'm trying to do a simple thing:
    
    I display a Label Widget (created and managed in C). It is created
    using the default colors.
    
    Then, always in C, I would like to create another Label Widget but "in
    reverse", that means that I would like the foreground to become the
    background and viceversa.
    
    I tried declaring the following
    
    	Screen *screen = XtScreen(top_level);
    	Display *display = DisplayOfScreen(screen);
    
    	and then using the XtGetArg with the DwtNforeground and
    DwtNbackground qualifiers I thought I really had the foreground and
    background colors (declared as Pixel).
    
    So, I tried to use the xtSetArg JUST inverting the fore/background
    stuffs. 
    BUT IT DID NOT WORK. The only result I have is that both the back and
    fore are BLACK and I do not see my label any more.
    
    Could someone help me just providing a simple 20 lines of code that
    performs this stupid task ?
    
    Thanks a lot !
    
    /�og
T.RTitleUserPersonal
Name
DateLines
3155.1GetValues, the SetValue or CreateR2ME2::OBRYANWed Aug 01 1990 12:3938
RE:.0

>I would like to create another Label Widget but "in reverse"

How about something like this:
Get the foreground & background of the existing label widget, then use these
values to SetValue or Create the New label widget.

XColor   *a_foreground;	XColor   *a_background;
Arg r_args[2];


...
    XtSetArg(arg[0], DwtNforeground, &a_foreground );
    XtSetArg(arg[1], DwtNbackground, &a_background );
    XtGetValues( existing_label_widget, r_args, 2);

    XtSetArg(arg[0], DwtNforeground, a_background );
    XtSetArg(arg[1], DwtNbackground, a_foreground );

then either:

	XtSetValues( new_label_widget, r_args, 2);
OR

	DwtFetchWidgetOverride(ar_UIHierarchy,
		"fetched_label_name",
		ar_parent_widget,  NULL,
		r_args, 2,
		&new_label_widget,
		&a_dummy_class )
OR

	DwtLabelCreate(...,r_args,2)


Michael
3155.2BBOOP::SCAERWed Aug 01 1990 14:115
	Also, make sure that your label is
	a widget and not a gadget because
	foreground and background colors cannot
	be changed on a gadget.