have you ever wanted to extend a selection with shift+ arrow?
Just slip the 2 self contained FNs - the only constants they
use are FB defined, no global vars are used... - and then use
the SELECT/CASE example in your TEKEY handling, and voilĂ !
This will work in FB Edit Fields. I have no idea for PG stuff.
'-------------- CODE FOLLOWS ------------------
CLEAR LOCAL MODE
' this could be done with bit masks, equalling the variable passed
' in which case it would be simpler:
' CALL GETKEYS( keys)
' result = row2& and whichKey
' perhaps someone can try...
LOCAL FN getModKeys( whichKey)
DIM keys;0 , row1&, row2&, row3&, row4&
DIM result
result = _false
CALL GETKEYS ( keys) 'load key state to keys Record
'
SELECT whichKey
CASE _shiftKey
IF row2& = &00000001 THEN result = _true
CASE _cmdKey
IF row2& = &00008000 THEN result = _true
CASE _optionKey
IF row2& = &00000004 THEN result = _true
END SELECT
END FN = result
'/-------------------------------------------------------
CLEAR LOCAL MODE
LOCAL FN arrowActions( charId)
DIM startPoint, finishPoint, textLength
DIM result
'
result = _false
'
LONG IF FN getModKeys( _shiftKey)
startPoint = WINDOW( _selStart)
finishPoint = WINDOW( _selEnd)
textLength = WINDOW( _efTextLen)
'
SELECT charID
CASE _efLeftArrow
IF startPoint > 0 THEN DEC( startPoint)
CASE _efRightArrow
IF finishPoint < textLength THEN INC( finishPoint)
CASE _efUpArrow
' normally you would have to calculate up point in
' next line - but here only dealing with one line
startPoint = 0
CASE _efDownArrow
' normally you would have to calculate up point in
' next line - but here only dealing with one line
finishPoint = textLength
END SELECT
' set the new selection
SETSELECT startPoint, finishPoint
result = _true
END IF
END FN = result
'/-------------------------------------------------------
LOCAL FN doTEkey
DIM theKey$
theKey$ = TEKEY$ 'Key From User
SELECT CASE ASC( theKey$)
CASE 28
IF FN arrowActions( _efLeftArrow) THEN theKey$ = ""
TEKEY$ = theKey$
CASE 29 'Arrow keys
IF FN arrowActions( _efRightArrow) THEN theKey$ = ""
TEKEY$ = theKey$
CASE ELSE
' normal key stuff goes here
TEKEY$ = theKey$
END SELECT
'
END FN
'/-------------------------------------------------------
Hope someone finds this useful.
jonathan
-------------------------------------------------------------
! "format utile" studio de graphisme/graphic design studio !
! 32 bd de Menilmontant, 75020 Paris, France !
! phone +33 1 43 49 02 04 +++ fax +33 1 43 49 16 51 !
-------------------------------------------------------------
*** coming soon to a browser near you ***
<http://www.cybercities.com/formatutile>
-------------------------------------------------------------