Positioning the window cursor

move cursor to

Position the window cursor (pixel positioning)

at

Position the window cursor (character positioning)

SYNTAX

move cursor to x, y in window_id
at column, row [in window_id]

Positions the window’s logical cursor at the specified position relative to the top left-hand corner, or origin, of the window. This corner is position 0, 0.

The move cursor to command uses pixel positioning. This is a much more accurate method of placing the cursor, and is the default method from Sculptor V5 onwards.

The at command uses character positioning, based on columns and rows rather than pixels. This is the only method that was available prior to Sculptor V5.

x, y

The x and y co-ordinates at which the cursor is to be positioned (pixel positioning). Both x and y may be any expression that evaluates to an integer value.

column, row

The column and row at which the cursor is to be positioned (character positioning). Both column and row may be any expression that evaluates to an integer value.

in window_id
[in window_id]

If move cursor to is used, the window must be specified.

If at is used, specifying the window is optional (though recommended). If the in window_id clause is absent, the task window wintask is used.

A window specified with the in window_id clause need not be visible.


Commands that may require cursor positioning

The at and move cursor to commands are generally used prior to a command which produces output with a definable position, or to position the cursor before opening a popup menu. These commands are:

draw hline

Draws a horizontal line. The line is drawn from left to right starting at the window’s logical cursor position.

draw rectangle

Draws a rectangle. The top left corner of the rectangle is placed at the window’s logical cursor position.

draw vline

Draws a vertical line. The line is drawn from top to bottom starting at the window’s logical cursor position.

fill rectangle

Flood fills a rectangular area, whose left-hand corner is placed at the window’s logical cursor position.

put

Writes formatted data into a window, starting at the window’s logical cursor position.


EXAMPLE

  1. Position cursor in order to open a popup menu:

    menu IndexTableMenu {
         style = WS_POPUP
    
         menuitem MenuIndexDetails {
              label = "&Details"
              select = IndexDetails
         }
    }
    
    !function IndexTableEvent(EventCode, Object, Line, Column, XCtrl, YC trl, XWin, YWin) {
         if (EventCode <> EV_RIGHT_MOUSE_UP)then return
         if (Line < 1) or (Line > NumIndexes) then return
         move cursor to XWin, YWin in wintask
         open wintask.IndexTableMenu
         return
    }
    

RELATED TOPICS

Logical cursor position

Pixel and character positioning