comparison man/lispref/windows.texi @ 2289:7fa4bc78a35d

[xemacs-hg @ 2004-09-21 02:59:59 by james] Darryl Okahata's patch to add current-pixel-row.
author james
date Tue, 21 Sep 2004 03:00:27 +0000
parents 33f0f28b945c
children 61aaa5e258b0
comparison
equal deleted inserted replaced
2288:63d767a4650c 2289:7fa4bc78a35d
1047 @section Windows and Point 1047 @section Windows and Point
1048 @cindex window position 1048 @cindex window position
1049 @cindex window point 1049 @cindex window point
1050 @cindex position in window 1050 @cindex position in window
1051 @cindex point in window 1051 @cindex point in window
1052 @cindex cursor in window
1052 1053
1053 Each window has its own value of point, independent of the value of 1054 Each window has its own value of point, independent of the value of
1054 point in other windows displaying the same buffer. This makes it useful 1055 point in other windows displaying the same buffer. This makes it useful
1055 to have multiple windows showing one buffer. 1056 to have multiple windows showing one buffer.
1056 1057
1095 @end defun 1096 @end defun
1096 1097
1097 @defun set-window-point window position 1098 @defun set-window-point window position
1098 This function positions point in @var{window} at position 1099 This function positions point in @var{window} at position
1099 @var{position} in @var{window}'s buffer. 1100 @var{position} in @var{window}'s buffer.
1101 @end defun
1102
1103 @defun current-pixel-row &optional window pos
1104 @defunx current-pixel-column &optional window pos
1105 @cindex cursor pixel row
1106 @cindex window point pixel row
1107 @cindex cursor pixel column
1108 @cindex window point pixel column
1109 The function, @code{current-pixel-row}, returns the vertical location,
1110 in pixels, of the point @var{pos} within the specified @var{window};
1111 similarly, @code{current-pixel-column} returns the corresponding
1112 horizontal location. The position returned is that of the upper-left
1113 corner of the cursor, and is relative to the upper-left location of the
1114 window. If @var{window} is @code{nil}, the function uses the selected
1115 window. If @var{pos} is @code{nil}, the value of @code{window-point} is
1116 used.
1117
1118 Note that the coordinates are relative to the current XEmacs window, and
1119 are not relative to the XEmacs X11 window. To obtain the coordinates
1120 relative to the X11 window, you must also take into account the spacings
1121 of any menubars, gutters, toolbars, margins, etc., as well as any window
1122 offsets. The function, @code{window-pixel-edges} (@pxref{Position of
1123 Window}), can be used to help calculate the location relative to the
1124 frame.
1125
1126 @emph{Important note}: in order for these functions to return a correct,
1127 non-nil value, two criteria @emph{must} be satisfied:
1128
1129 @itemize @bullet
1130
1131 @item
1132 The location of @code{pos} must be visible within the specified window.
1133 If @var{pos} is outside the visible area, @code{nil} is returned.
1134
1135 @item
1136 As the pixel location is determined from the redisplay tables, the
1137 redisplay tables must be up-to-date. In other words, the XEmacs
1138 window(s), as seen by the user, must be correct (to improve performance,
1139 XEmacs generally defers display updates until control returns back to
1140 the idle loop). To insure that the redisplay tables are up-to-date, one
1141 of the following must generally be done @emph{before} calling
1142 @code{current-pixel-row} or @code{current-pixel-column}:
1143
1144 @itemize @bullet
1145
1146 @item
1147 If the window in question is not in a new frame, you can force a
1148 redisplay using @code{(sit-for 0)}. See @code{sit-for} in
1149 @ref{Waiting}.
1150
1151 @item
1152 If the window in question is in a new frame, you must call code like the
1153 following:
1154
1155 @example
1156 @group
1157 (while (not (frame-visible-p frame))
1158 (sleep-for .5))
1159 @end group
1160 @end example
1161
1162 @end itemize
1163
1164 @end itemize
1165
1166 If one of these is not done, the return value may be incorrect, even if
1167 it is non-nil.
1168
1100 @end defun 1169 @end defun
1101 1170
1102 @node Window Start 1171 @node Window Start
1103 @section The Window Start Position 1172 @section The Window Start Position
1104 1173