[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

119.0. "Transparent rectangle (shell widget?)" by USHS09::YARBROUGH () Fri Feb 03 1989 11:28

   I was wondering how to display the outline of a box and move it 
   around the screen with the cursor.  Examples can be seen everywhere:
      - when you move a DECterm window around on the screen there is an 
        outline that appears as long as your mouse button is down, 
      - moving icons around in the Icon Box is the same way, and 
      - in the DWICS editor when you select a widget from the menu, a
        transparent rectangle is attached to the cursor and moves as
        long as the mouse button is down.

   I would guess that it is some kind of a shell widget but I can't
   seem to find the key to making it transparent.

   As always, thanks for any help.
   Lynn

T.RTitleUserPersonal
Name
DateLines
119.1Just linesFLUME::dikeFri Feb 03 1989 12:1510
Those aren't any kind of widget.  Just lines being drawn on the root window.
Your GC needs to have subwindow_mode set to IncludeInferiors, function set to
GXinvert, and plane_mask set to foreground ^ background.  I use WhitePixel() and
BlackPixel() for foreground and background.

There are probably other ways of doing rubberbanding, but this is the way dxwm 
does it.
				Jeff
				

119.2Unfortunately, that is a 90% solution, not the whole ball of wax!DECWIN::FISHERBurns Fisher 381-1466, ZKO3-4/W23Fri Feb 03 1989 16:5827
Please note that there is no perfect solution for doing this (at least not
without being very expensive).   Jeff's solution is what most people do, and
it works most of the time. However, it won't work ALL of the time.  For example, if you
have an 50% gray pattern like this:

	bwbwbwbwbwbwbwbwbw
	wbwbwbwbwbwbwbwbwb
	bwbwbwbwbwbwbwbwbw

etc, even on a monochrome system, the stretchy box will be nearly invisible
(it just shows up as a slight phase shift).  On a color system, if you are
drawing into an area which is not either blackPixel or WhitePixel, there is no
guarantee of what color the result of the masked Invert will be if you are not
drawing over either blackPixel or WhitePixel.

There is only one solution that I know of that will work better. 
That is to capture the screen under which you are drawing, draw two
parallel, contrasting lines for each line you want to see.  When you move the
line, restore the saved piece of the screen.  This has two problems:  (1)
it is probably two slow and (2) GetImage or CopyArea (which you would probably
use to save the bits) don't work as you expect if you have multiple depths and
overlapping windows on the screen).

Sigh.  Sounds like we need an extension to make the server do the right thing!

Burns

119.3CASEE::LACROIXNo futureMon Feb 06 1989 04:0713
    Re .1:

    You may want to grab the server to deal with the case where a window
    gets scrolled under you ghost rectangle.

    Re .2:

    Burns is right (of course) in theory. Practically, it works Ok in 99%
    cases. A server extension would be nice, but maybe hard to justify
    unless the cost of SPRs gets very high...

    Denis.

119.4Be careful with server grabbingFLUME::dikeMon Feb 06 1989 08:506
It's true that you'll probably want to grab the server during this operation.
However, while debugging, if you accidentally put a breakpoint between the
XGrabServer and XUnGrabServer, you're hosed until you log in from somewhere
else and kill the process that you're debugging.
				Jeff

119.5Thanks !USHS09::YARBROUGHThu Feb 09 1989 16:007
   Thanks for the hints !  You put me on the right track and everything
   is working now.  Grabbing the server did benefit.  When I get a chance
   I'll put some example code in the DW_EXAMPLES conference.  Until then,
   if anyone is interested in seeing the code, send me mail:
   USHS09::YARBROUGH.

119.6BOOTIS::BAILEYThe Pursuit Of _Knowledge_Fri Apr 07 1989 13:298
Anyone got a (simple) example of the method as used in .1 ?

(I keep winding up with black text on a black window)

Ta

Peb