Christian,
> How do I get the x window coordinates for a live rc_graphic window?
I assume you mean after the window has been manually moved, since, the
teach and help files tell you about rc_window_x and rc_window_y.
I am copying my answer to pop-forum (comp.lang.pop) in case someone else
has a better answer. It is incredibly difficult to find out simple
things like this from the Poplog online X documentation (much of which
quite unreasonably assumes users are going to have X manuals on their
desks).
After much fruitless searching of online documentation, I eventually
made a guess that I had to use XptShellOfObject to get XptWidgetCoords
to do what I expected, and found that this worked. A procedure (with
updater) to access and update current window location of the rc_graphic
window.
define rc_window_coords() -> (x, y);
;;; Return x and y position of rc_window on screen
lvars x,y;
XptWidgetCoords(XptShellOfObject(rc_window)) ->(x, y, , );
enddefine;
define updaterof rc_window_coords(x, y);
;;; integers x and y should be on the stack
x,y,false,false ->
XptWidgetCoords(XptShellOfObject(rc_window));
enddefine;
/*
;;; test
;;; move window around and check this
rc_window_coords() =>
600,800 -> rc_window_coords();
vars x;
for x from 1 by 10 to 700 do
x, 100 -> rc_window_coords()
endfor;
*/
;;; By analogy with the above we can define procedures to access and
;;; update the curent window dimensions.
define rc_window_dimensions() -> (width, height);
;;; Return width and height position of rc_window on screen
lvars width,height;
XptWidgetCoords(XptShellOfObject(rc_window)) ->(, ,width, height);
enddefine;
define updaterof rc_window_dimensions(width, height);
;;; integers width and height should be on the stack
false,false,width,height,->
XptWidgetCoords(XptShellOfObject(rc_window));
enddefine;
/*
;;; test
;;; Change window size and check this
rc_window_dimensions() =>
600,800 -> rc_window_dimensions();
60,60 -> rc_window_dimensions();
vars x;
for x from 1 by 10 to 700 do
;;; just keep changing the x dimension
;;; try this with different manually adjusted window heights
x, false -> rc_window_dimensions()
endfor;
*/
Unless someone has better ideas, I'll put these in the local Poplog
library and (ftp directory) at Birmingham.
Aaron
----
|