Chapter Contents |
Previous |
Next |
Extended Text Entry: _feedback |
Syntax | |
Details | |
Example |
Syntax |
_feedback:METHODevent$20lineoffset8;endmethod; |
Argument | Type | Description |
---|---|---|
event |
C | specifies the event code that modified the line |
line |
N | specifies the line number of the affected line |
offset |
N | specifies the character offset of the affected character |
Details |
The _feedback method is run for every character that is input when the Keystroke Feedback mode is chosen from the attribute window, or when the _setMode method is called with the parameter 'ALWAYS'. See _setMode in this class.
The _feedback method is run for every carriage return regardless of mode settings. Do not call this method from the SCL code using _callNotify or _callSend. Define a method block and use it to override the _feedback method. The _feedback method will be called automatically. The following events are then sent to this method:
Possible Events | Value is... |
---|---|
PRINTABLE | a printable character was typed in |
RETURN | a Carriage Return or New Line was entered |
DELWORD | a word was deleted |
DELPREVWORD | the previous word was deleted |
DELCHAR | a character was deleted |
DELPREVCHAR | the previous character was deleted |
DELTOEOL | all characters to the end of the line were deleted |
DELTOBOL | all characters to the beginning of the line were deleted |
DELLINE | the line was deleted |
ENTER | massive changes were made to the object in one operation |
Example |
This example uses the _feedback method to test input against a list of color names. If a match is found, the entered value is replaced with
the found value. The portion of text that is typed in is marked so that the next keystroke replaces that text. For example, if you type
'R'
, it displays
'RED.'
If you then type an
'O'
following the
'R'
, it displays
'ROSE'
.
length v $ 200; fb: method event $ 20 line offset 8; call send(_self_, "_getText", v); len = length(v); if (len = 0) then return; if (event ^= "PRINTABLE") then return; /* get the list of valid values */ l = getniteml(_SELF_, "LIST"); rc = searchc(l, v, 1, 1, 'y', 'y'); if (rc > 0) then do; v = getitemc(l, rc); call send(_SELF_, "_setText", v); call send(_SELF_, "_setSelect", 1, len+1, 1, 200); end; endmethod; /* _init method sets up the list that is used to hold all possible */ /* valid selections */ init: method; call super(_SELF_, "_init"); l = makelist(); rc = insertc(l, "BLACK", -1); rc = insertc(l, "WHITE", -1); rc = insertc(l, "RED", -1); rc = insertc(l, "GREEN", -1); rc = insertc(l, "BLUE", -1); rc = insertc(l, "PURPLE", -1); rc = insertc(l, "VIOLET", -1); rc = insertc(l, "ORANGE", -1); rc = insertc(l, "YELLOW", -1); rc = insertc(l, "PINK", -1); rc = insertc(l, "CYAN", -1); rc = insertc(l, "MAGENTA", -1); rc = insertc(l, "BROWN", -1); rc = insertc(l, "GOLD", -1); rc = insertc(l, "LIME", -1); rc = insertc(l, "GRAY", -1); rc = insertc(l, "LILAC", -1); rc = insertc(l, "MAROON", -1); rc = insertc(l, "ROSE", -1); rc = setniteml(_SELF_, l, "LIST"); /* force _feedback method to run all the time */ call send(_SELF_, "_setMode", "ALWAYS"); endmethod; /* Don't forget to cleanup during the _term method */ term: method; l = getniteml(_SELF_, "LIST"); rc = dellist(l); call super(_SELF_, "_term"); endmethod;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.