[comp.windows.x.motif] Getting the co-ordinates of the widgets in a callback

marbru@attc.UUCP (Martin Brunecky) (01/12/91)

In article <11232@cae780.csi.com> kv@csi.com  (Kumar Venkatramani) writes:
>Can anybody tell me what is the preferred way to read the current co-ordinate 
>positions of the widget in one of its callbacks ?  I need to find the
>current position in order to place another bulletinBoard to the right of this
>widget...
>

    I use XTranslateCoordinates (hope that's the spelling), not the
    XtTranslateCoords.

    The Xlib call does the roundtrip (baddd...),but is RELIABLE.
    The Xt call collects x,y up the widget tree, which should be
    correct, but... (in particular with Motif 1.0) ... often the
    Shell does not have correct x,y, Motif DialogShell plays ugly
    tricks with x,y etc.
    
    So I prefer the delay rather than the Sun's approach: 
     ... do it FAST, may be it will be correct.

    Ahhh. To provide the full info:

    XTranslateCoordinates ( XtDisplay(w), XtWindow(w),
                            XRootWindowOfScreen(XtScreen(w)),
                            (int)0, (int)0, &x, &y, &child_widget );

    which gives me x,y of the widget's origin (0,0) in the Root
    window of the screen, i.e. where I want to position my shell.


 -- Martin

-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                           {...}sunpeaks!auto-trol!marbru
(303) 252-2499                        (sometimes also:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404