You can lock a cursor coordinate and thereby restrict the movement of the cursor by pressing Alt (Windows) or Opt (Mac) and either X, Y, A, or R/D on the keyboard.
If the Snap Guides and Snap Points function is active:
•Alt/Opt + X produces a vertical Snap Guide.
•Alt/Opt + Y produces a horizontal Snap Guide.
•Alt/Opt + A (having defined the Angle value numerically or drawing in a sample direction) produces a corresponding Snap Guide.
•Alt/Opt + R produces a Snap Guide Circle whose radius is determined numerically or graphically.
To unlock the constraint, just press the same key combination (e.g. Alt/Opt + X) again.
If the Snap Guides and Snap Points function is inactive, the locking function works the same way, but you will not see the Snap lines/points.