Skip to main content

[archive] Backspace in grid

  • October 29, 2010
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 28 October 2010]

Is there a way to make the Backspace key function like the Delete key within a grid control? In other words, when a cell has focus in the grid & the Delete key is typed, the cell contents are deleted and the cell is activated for entry. Can I make the Backspace key do the same thing?

1 reply

[Migrated content. Thread originally posted on 28 October 2010]

Is there a way to make the Backspace key function like the Delete key within a grid control? In other words, when a cell has focus in the grid & the Delete key is typed, the cell contents are deleted and the cell is activated for entry. Can I make the Backspace key do the same thing?
you can use W$KEYBUF.

Example: (only some snippets from a programm i added my test)

       77  function-key-pressed
           is special-names crt status           pic 9(4).
           88  exit-button-pushed                value 13.
           88  exit-pushed                       value 900.
           88  event-occured                     value 96.
           88  screen-no-input-field             value 97.
           88  screen-time-out                   value 99.
           88  f1-pressed                        value 1.
           88  f2-pressed                        value 2.
           [COLOR="blue"][b]88  backspace-pressed                 value 54.[/b][/COLOR]

......

       main-routine.
           perform until exit-button-pushed
               move    4 to accept-control
               accept  main-screen
                       on exception     perform on-exception
                       not on exception perform no-exception
               end-accept
           end-perform

           go to exit-programm.

.....

       on-exception section.
           evaluate true
              when exit-pushed
                   set exit-button-pushed to true
              when backspace-pressed
                   evaluate control-id
                      when 101   [COLOR="DarkRed"]| Grid-ID[/COLOR]
[COLOR="Blue"][B]                           CALL "W$KEYBUF" USING "1", "{^M} {KX}"
                                END-CALL[/B][/COLOR]
                      when other
                           continue
                   end-evaluate
              when other
                   continue
           end-evaluate.

.......


{^M} = Enter Pressed
{KX} = Delete

See my cblconfi:

KEYSTROKE Exception=44 Edit=End         KE
KEYSTROKE Exception=45 Edit=Down        kd
KEYSTROKE Exception=46 Edit=Up          ku
[COLOR="blue"][B]KEYSTROKE Exception=47 Edit=Delete      KX[/B][/COLOR]
KEYSTROKE Exception=48 Edit=Auto-Insert KI
KEYSTROKE Exception=49 Edit=Home        kh
KEYSTROKE Exception=50 Edit=Left        kl
KEYSTROKE Exception=51 Edit=Right       kr
KEYSTROKE Exception=52                  Kl
KEYSTROKE Exception=53                  Kr
KEYSTROKE Exception=54 Edit=Backspace   ZB
KEYSTROKE Exception=55                  KB
KEYSTROKE Exception=56                  K?
KEYSTROKE Exception=57                  KL
KEYSTROKE Exception=58                  KV
KEYSTROKE Exception=59                  ^V
[COLOR="blue"][B]KEYSTROKE Terminate=90                  ^M[/B][/COLOR]