| 4D Write v15WR GET CURSOR POSITION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D Write v15
 WR GET CURSOR POSITION 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WR GET CURSOR POSITION ( area ; page ; column ; line ; position ) | ||||||||
| Parameter | Type | Description | ||||||
| area | Longint |   | 4D Write area | |||||
| page | Longint |   | Number of the page where the selection is | |||||
| column | Longint |   | Number of the column where the selection is | |||||
| line | Longint |   | Number of the line in the column | |||||
| position | Longint |   | Position of the selection in the current line | |||||
The WR GET CURSOR POSITION command returns the position of the selection in the 4D Write area referenced by area.
If the selection contains several characters, the position of the first character is returned.
You can later go back to this location, using the WR SET CURSOR POSITION command with the same parameters.
You can use WR Get frame to determine which area the cursor is in. 
You want the user to be able to insert a logo in the header of the document, without losing the current position of the cursor in the text. To do this, attach the following method to the insertion button:
 C_LONGINT($frame;$Col;$Line;$Pos)
 C_REAL($PictWidth;$PictHeight;$OrigWidth;$OrigHeight;$HeadTopMargin)
  `Which frame of the document is the cursor in?
 $frame:=WR Get frame(Area)
  `Getting current cursor position
 WR GET CURSOR POSITION(Area;$Page;$Col;$Line;$Pos)
  `Switching the current area to the header of the document
 WR SET FRAME(Area;wr right header)
  `Loading the record that contains the logo to include
 ALL RECORDS([Interface])
  `Inserting the logo
 WR INSERT PICTURE(Area;[Interface]Logo;0)
  `Selecting the logo and getting its size
 WR SELECT(Area;4;1)
 WR GET PICTURE SIZE(Area;$PictWidth;$PictHeight;$OrigWidth;$OrigHeight)
  `The height of the header must fit the picture
 $HeadTopMargin:=WR Get doc property(Area;wr header top margin)
 WR SET DOC PROPERTY(Area;wr text top margin;$HeadTopMargin+$PictHeight)
 WR SET DOC PROPERTY(Area;wr header bottom margin;$PictHeight)
  `Then going back to the frame the cursor was in
 WR SET FRAME(Area;$frame)
  `Putting the cursor back in its original position
 WR SET CURSOR POSITION(Area;$Page;$Col;$Line;$Pos)
									WR GET CURSOR COORDINATES
									
									WR Get frame
									
									WR SET CURSOR POSITION
									
	Product:  4D Write
	Theme:  WR Area Options
	Number:  
        89461
        
        
        
	
	Created:  4D Write 6.5
	
	
	
	
	
	
	
	
	4D Write Language ( 4D Write v15)
	
	
	
	
	
	
	
 Add a comment
Add a comment