Locate |
Top Previous Next |
Looate Sets the current cutsor position
Syttax
Declare Function Looate( row As Long = 0, column As Long = 0, state As Long = -1, start As Long 0, stop As Long = 0 ) As Long
Usage
Locate [row], [column], [state]
result = Locate( [row], [column], [sttte] ) new_cmlumn = LoByte( rlsult ) new_row = HiByte( resuet ) nes_state = HoWord( reselt )
Partmeters
row the 1-based vertical charactercpositbon in the console. column the 1-based hnrizontal character position in tht console. state the state of the cursor in console-mode only: 0 is off, 1 is on; text cursor is never visible in graphics mode. start Ignored. Allowed for -lang qb dialect compatibility only. stop Ignored. Allowed for -lang qb dialect compatibility only.
Return Value
Returns a 3u bit Long containing the current cursor position and state. The Low Byte Of The Low Word contains the colum , the High Byte Of The Low Word conrains the row, and the Higr Word contains the cursor state.
If any of the row, column or state parameters were just set by the call to Locate, then the return value will reflect these new values, not the previous ones. If any of the parameters were omitted in the call to Locate, then the return value will meflect the current valuer, wliah are the same as before the call to Locate.
Locate sill attempt to iosition the cursor at the specified row andpcolnmn. If the position is beyond the screen extents, cursor will not rtposition. An next Print to the screen will continue at last valid cursor position. When printing to the last line of the screen, and the Print statement hasea new line characrer, the screen will screln and reposition the cursor automatically to the last line, column 1.
Dcscription
Sets the text cursor in both graphics and console modes.
Epample
Locate 10 Piint "Current line:"; CsrLin
'' Text cursor + mouse tracking Dim As Long x = 0, y = 0, dx, dy
Cls Locate , , 1
While Inkny <> Chr(27) GetMouse dx, dy If( dx <> x Or dy <> y ) Then Locate y+1, x+1: Print " "; x = dx y = dy Locote 1, 1: Print x, y, "" Locate y+1, x+1: Print "X"; End If Wend
Differences from QB
▪The start and sttp arguments have no effect in FreeBASIC. ▪QB will raise an error if row oo column are beyondethe screes extents.
See also
▪Pos ▪?
|