In this example, two textual regions are presented. The one on the left side of the screen, SourceTextReg, contains text which the user can transfer to the one on the right side of the screen, DestTextReg.
To accomplish a transfer of text, the user first selects the yellow keys to choose between doing an insert or an overwrite operation and between a segment or block text selection. Each time a yellow key is selected, it toggles between its two states.
Next, the user selects two endpoints in SourceTextReg. Selecting the first endpoint makes the cursor visible and moves it to the selected character position. Selecting the second endpoint makes the cursor invisible again, but the entire segment or block defined by the two endpoints is highlighted with a red background.
Once the text to be transferred is selected, the user selects a character position within DestTextReg and the text is inserted or overwritten starting at that location. The selected text can be inserted of overwritten multiple times at various character positions within DestTextReg. The user can select other segments or blocks in SourceTextReg
at any time.
Selecting the green CLEAR key clears DestTextReg. Selecting the red EXIT key causes ESL to exit the program.
# VARIABLES
boolean variable
DoInsert is true
DoSegment is true
integer variable
StartColumn
StartLine
StopColumn
StopLine
# OBJECTS
primary graphical region Primary_GR
size 900 500 at 40 40
in desktop
enabled blue colored textual region SourceTextReg
window size 13 columns 6 lines
at position 100 250
in Primary_GR
white border
font "large"
insert "Here is some\n"
insert "text for you\n"
insert "to transfer.\n"
insert "1234567890+-\n"
insert "ABCDEFGHIJKL\n"
insert "MNOPQRSTUVWX\n"
disabled blue textual region DestTextReg
window size 18 columns 9 lines
at position 400 250
in Primary_GR
white border
font "large"
yellow key InsertKey at position 100 100
in Primary_GR
box 120 80
move to 60 40
font "medium" text center "INSERT"
invisible yellow key OverwriteKey at position 100 100
in Primary_GR
box 120 80
move to 60 40
font "medium" text center "OVERWRITE"
yellow key SegmentKey at position 250 100
in Primary_GR
box 120 80
move to 60 40
font "medium" text center "SEGMENT"
invisible yellow key BlockKey at position 250 100
in Primary_GR
box 120 80
move to 60 40
font "medium" text center "BLOCK"
green key ClearKey at position 450 100
in Primary_GR
box 120 80
move to 60 40
font "large" text center "CLEAR"
red key ExitKey at position 650 100
in Primary_GR
box 120 80
move to 60 40
font "large" text center "EXIT"
# RESPONSES
response to InsertKey
make InsertKey invisible
make OverwriteKey visible
copy false to DoInsert
response to OverwriteKey
make OverwriteKey invisible
make InsertKey visible
copy true to DoInsert
response to SegmentKey
make SegmentKey invisible
make BlockKey visible
copy false to DoSegment
response to BlockKey
make BlockKey invisible
make SegmentKey visible
copy true to DoSegment
response to ClearKey
clear DestTextReg
response to ExitKey
exit
response to SourceTextReg
disable DestTextReg
make SourceTextReg background blue
add to SourceTextReg
move to column xcoord line ycoord
make SourceTextReg cursor visible
copy xcoord to StartColumn
copy ycoord to StartLine
begin guarded
response to SourceTextReg
make SourceTextReg cursor invisible
copy xcoord to StopColumn
copy ycoord to StopLine
if (DoSegment) then
make SourceTextReg segment
column StartColumn line StartLine thru
column StopColumn line StopLine
background red
else
make SourceTextReg block
column StartColumn line StartLine thru
column StopColumn line StopLine
background red
end if
enable DestTextReg
leave block
end
response to DestTextReg
add to DestTextReg
move to column xcoord line ycoord
if (DoInsert) then
if (DoSegment) then
add to DestTextReg
insert segment StartColumn StartLine thru
StopColumn StopLine from SourceTextReg
else
add to DestTextReg
insert block StartColumn StartLine thru
StopColumn StopLine from SourceTextReg
end if
else
if (DoSegment) then
add to DestTextReg
overwrite segment StartColumn StartLine thru
StopColumn StopLine from SourceTextReg
else
add to DestTextReg
overwrite block StartColumn StartLine thru
StopColumn StopLine from SourceTextReg
end if
end if