[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

2454.0. "XTranslateCoordinates ??" by KAOU35::DLEROUX () Thu Mar 15 1990 15:12

    
    Has the XTranslateCoords function been changed in VMS 5.4? 
    
    I have a hierarchy which looks like this :
    
    				topLevel
    			     /		\
    			dialogBox	mainWindow
    			 |		 |
    			simpleText	window
    
    I have an event handler on the window widget and I am trying to change
    the coordinates of that press button event to coordinates in the
    dialogBox so that I can make the simpleText appear where the button was
    pressed.  
    
    The XTranslateCoordinates gives me an access violation.  I checked my
    arguments and they are o.k.
    
    When I use XtTranslateCoords on the two windows and calculate their
    offset and add this to the event->x, it looks like the window widget
    has a higher resolution than the dialogBox (is this possible??) because
    when the button is pressed close to the upper corner the stext appears
    in the correct position. But the farther away you get from the top corner,
    the more the stext appears to the right and under the button press.
    
    Dan
    
T.RTitleUserPersonal
Name
DateLines
2454.1FontUnits?DECWIN::KLEINThu Mar 15 1990 15:436
Sounds like you're using FontUnits to position the SText within its parent.
Is wouldn't happen to be a dialog box, would it?

If not, post some code.

-steve-
2454.2It is a dialog box ... thanks KAOU35::DLEROUXThu Mar 15 1990 16:580
2454.3XTranslateCoordinates vs. XtTranslateCoordinatesRTL::JUNEFri Mar 16 1990 09:4328
  Incidentally, you might want to get XTranslateCoordinates working.  A bug
  (in the Shell implementation, I think) sometimes causes the Xt call to return
  incorrect coordinates.  The most noticeable example is when the user picks
  up the window containing the widget whose coordinates you're getting and
  moves it.  Subsequent calls to XtTranslateCoordinates will return values
  corresponding to the widget's old position, before the window was moved.
  Messing around with the window (i.e. iconizing and the deiconizing, etc)
  will fix the problem, but only until the window is moved again.

  The XTranslatesCoordinates call doesn't have this problem (although it is
  slower than the Xt call because it queries the server for position info).
  Here is an example of using it:
  
    int dx, dy;
    Display *disp = XtDisplay (toplevel);
    Window window;

    XTranslateCoordinates (disp, XtWindow(wid), DefaultRootWindow (disp),
                           0, 0, &dx, &dy, &window);

  where toplevel is my top level widget and wid is the widget whose coordinates
  I'm translating.  The 0,0 specifies the upper left hand corner of this widget.
  Note that the widget must be realized, so that it has a valid window.
 
                                                          Rich


2454.4I tried ...KAOU35::DLEROUXFri Mar 16 1990 11:5216
    
    I tried using XTranslateCoordinates with the following arguments and it
    gave me a access vio error. ( I'm running vms5.4-eft )
    
    Window *window;
    
    XTranslateCoordinates( display, XtWindow( window_widg ),
    			   XtWindow( dialog_box ), 0, 0,
    			   &x, &y, window );
    
    The only thing I can see being wrong is that it doesn't like the
    windows positions in the hierarchy or the function has changed in
    DW2.1
    
    Dan
    
2454.5bug fix in previousOPHION::MIKEYMike YangFri Mar 16 1990 15:576
    window is a return argument, so use:
    
    Window window;
    
    .....   &window );