SD_PXENQ/IOW_PIXQ & SD_CHENQ/IOW_CHRQ
These traps return the window size and cursor position.
Trap | Value of D0.B | Action |
SD_PXENQ/IOW_PIXQ | $0A | Cursor position in pixel coordinates |
SD_CHENQ/IOW_CHRQ | $0B | Cursor position in character coordinates |
Call Parameters | Return Parameters |
D0.B | See above | D0.L | Error return. |
D1.L | | D1.L | Corrupted. |
D3.W | Timeout | D3.L | Preserved. |
A0.L | Channel ID | A0.L | Preserved. |
A1.L | Address of enquiry block | A1.L | Corrupted. |
Errors
ERR_NC | Not complete. |
ERR_NO | Channel not open. |
Notes
All registers not shown above are not used on entry and are preserved on exit.
A1.L must point to a four word block which will contain:
X-size of window
Y-size of window
X-position of cursor
Y-position of cursor
A pending newline is activated by this trap.
Example
The example below shows the use of this trap call to find the window size and the position of the cursor in pixel coordinates. It is assumed that A0 contains the window's ID.
enq moveq #sd_pxenq,d0 ; $0A
moveq #-1,d3 ; Timeout
lea ans,a1 ; Address of answer block
trap #3 ; Get the information
tst.l d0 ; OK? . .
bne error ; . . no!
ans ds.w 4 ; Space for the answer