<% @ Language="JScript" %> <% Server.Execute("/Server_Scripts/UpdateEntryCounter.asp"); %> Q & A: Special Key Macro


Q & A


Special Key Macro


With my old emulator, the Shift+End key combination would select all of the text in a field. There does not appear be a comparable function in eXpress Plus. Why?


The Shift+End key combination is a block selection keystroke reserved by Windows and, as such, may not be overridden; however, a script may be used to select text. Also, an alternate action key or key combination may be assigned to activate the script.

The following script selects the text in an unprotected field located at the current cursor position. Only the significant text is selected; i.e., trailing spaces are ignored. The script may be utilized with both T27 eXpress Plus and UTS eXpress Plus products.

You can copy the following code and past it into a file named SelectField.bas.


'This script selects all typed characters in the current field.
Sub Main()
Dim CRow as Integer
Dim CCol as Integer
Dim SCol as Integer
Dim ECol as Integer
Dim FoundBlank as Integer
Dim s as Integer
Dim l as Integer
Dim EndDel as String

' Get the cursor row and column.
CRow = GetCursorRow()
CCol = GetCursorCol()

If (GetScreenAttribute(CCol, CRow) and 8) = 8 Then ' Cursor must be in
' an unprotected area.
Exit Sub
End If

' Find the end of the field (or end of the line)
s = CCol
ECol = 80
If (GetScreenAttribute(s, CRow) and 8) = 8 Then
s = s - 1
ECol = s
Exit Do
End If
If s >= 80 Then
Exit Do
End If
s = s + 1
' s now points to character before next protected region
' Work backward to the first non space (or beginning of the field)
' then get the end of the selection
SCol = 1
FoundBlank = False
If (GetScreenAttribute(s, CRow) and 8) = 8 Then
SCol = s + 1
Exit Do
End If
If FoundBlank = False and GetScreenText(s, CRow, 1) <> " " Then
FoundBlank = True
ECol = s
End If
If s = 1 Then
SCol = s
Exit Do
End If
s = s - 1
' Move the cursor the start of the field.
SetCursor SCol, CRow
' Mark the selection
MarkBlock SCol, CRow, ECol, CRow
' Done.
End Sub




Information on the KMSYS Worldwide web server is Copyright (c) 1983-2013. All rights reserved.
All copyrights and trademarks are the property of their respective owners.
For information regarding this site, or to report a problem pertaining to the site, please contact support
License Agreements and Policies Privacy and Cookie Statements