faqts : Computers : Programming : Languages : Tse : Block

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: Block: Column: Line: How to get first line number in a marked block?

Oct 28th, 2006 06:35
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 28 October 2020 - 03:14 pm --------------------
TSE: Block: Column: Line: How to get first line number in a marked 
block?
===
Possible solutions:
===
Method: Query a built in TSE system variable
--- cut here: begin --------------------------------------------------
 PROC Main()
  Warn( "first line number = ", Query( BlockBegLine ) )
 END
 <F12> Main()
--- cut here: end ----------------------------------------------------
===
As a function
--- cut here: begin --------------------------------------------------
 INTEGER PROC FNBlockGetLineNumberFirstI()
  RETURN( Query( BlockBegLine ) )
 END
 PROC Main()
  IF NOT IsBlockMarked()
   Warn( "Please mark a block first" )
   RETURN()
  ENDIF
  Warn( "block: line number of first line = ", 
FNBlockGetLineNumberFirstI() )
 END
 <F12> Main()
--- cut here: end ----------------------------------------------------
===
Method: Goto first line of block and return that line position
--- cut here: begin --------------------------------------------------
 PROC Main()
  PushPosition()
  GotoBlockBegin()
  Warn( "first line number = ", CurrLine() )
  PopPosition()
 END
 <F12> Main()
--- cut here: end ----------------------------------------------------
===
As a function
--- cut here: begin --------------------------------------------------
 INTEGER PROC FNBlockGetLineNumberFirstI()
  INTEGER I = 0
  PushPosition()
  GotoBlockBegin()
  I = CurrLine()
  PopPosition()
  RETURN( I )
 END
 PROC Main()
  IF NOT IsBlockMarked()
   Warn( "Please mark a block first" )
   RETURN()
  ENDIF
  Warn( "block: line number of first line = ", 
FNBlockGetLineNumberFirstI() )
 END
 <F12> Main()
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
----------------------------------------------------------------------