Moving the cursor in a grid

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Moving the cursor in a grid

Post by gtisdale »

Does anyone know the syntax for changing the default cursor movement in a grid?

There was an enhancement at some point that allows you to default the next cell in a grid when enter is pressed, but I don't remember it and can not find the reference.

Thanks for the help.

FNGeorge
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

The answer to my queston is

CONFIG GRID_CURSOR DOWN
CONFIG GRID_CURSOR RIGHT
or
CONFIG GRID_CURSOR NONE

NONE is the default

Thank you Gordon for updating me on this.

===========================================

For the fun of it you might try using this in a grid.

Open your grid
EXECUTE "CONFIG GRID_CURSOR DOWN"
Just before your INPUT #listwin statement where you query the grid for information insert the following line

Code: Select all

LET FNACTIVEROW(LISTWIN,LISTSPEC$,UDIM(MAT HEADERS$),NEXTROW,LASTROW) !:                  LET SCR_THAW
Then do your input fileds line which also sets NEXTROW=nxtrow
Do some grid stuff and then return to your grid, not by going to the input fileds line, but by going to the FNACTIVEROW line

Then, somewhere in your program insert the following fnction or refer to the same function contained in a recent copy of FNSNAP.

WHen I was starting this I had to put an "X" atrtribute in each field of the FORMS statement array to get it to work when arrow keays were used to navigate the grid. Let me know if you find you need to do this.

Code: Select all

07700 DEF LIBRARY FNACTIVEROW(AWINNO,ASPEC$,UDIMH,ANXTROW,&ALASTROW) !:
      ! ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿!:
      ! ³ Color the first cell in a grid for the active line           ³!:
      ! ³ AWINNO  the window number the grid exists in                 ³!:
      ! ³ ASPEC$  the grid specification 1,1,22/23,GRID                ³!:
      ! ³ UDIMH   number of columns usually the DIM of MAT HEADERS$    ³!:
      ! ³ ANXTROW nxtrow set by BR must be manually set initially      ³!:
      ! ³ ALASTROW the last row that was highlighted                   ³!:
      ! ³                                                              ³!:
      ! ³   LET NEXTROW=1                                              ³!:
      ! ³   LET FNACTIVEROW(w,as$,udim(mat headers$),NEXTROW,LASTROW)  ³!:
      ! ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ!
07710 DIM AROW(2),AROW$(2)*50
07720 IF POS(UPRC$(ASPEC$),"GRID")>0 THEN 
07730 EXECUTE "config attribute [AA_ROW]N/#000000:#F7D688"
07740  MAT AROW(2) !:
       MAT AROW$(2)
07750 LET AROW(1)=ALASTROW*UDIMH-(UDIMH-1) !:
      LET AROW(2)=ANXTROW*UDIMH-(UDIMH-1)
07760 LET AROW$(1)="" !:
      LET AROW$(2)="[AA_ROW]"
07770 REM IF NOT CURROW=ALASTROW THEN !:                                                            LET AROW(1)=1 !
07780   PRINT #AWINNO, FIELDS ASPEC$&",attr": (MAT AROW, MAT AROW,MAT AROW$)
07790 END IF 
07800 LET ALASTROW=ANXTROW
07810 FNEND 
If it works, the active row should have a light orange background in the left hand column, much like Excel does.

FNGeorge
Post Reply