Using cursor-keys in a browse widget

nostromo

New Member
We are trying to port a character sales order application, which uses a matrix for entering quantities, to a GUI environment. One thing that the users like about the charater application, however, is the ability to cursor-arrow from cell to cell. We would like to use a standard browse widget to substitute this functionality, but I can't think of a way to let users type in quantities and then arrow backwards and forwards like in a spreadsheet. Does anyone have any ideas how to do this? At the moment I am using a Microsoft flexigrid ActiveX object, but I would like to do this just in Progress. (We are using Progess 9.1A).


Thanks for your help.
 

NickA

Member
I'd recommend users were told to use TAB, SHIFT+TAB to move between fields. I mean, you can trap the LEFT/RIGHT cursor keys but it means you can't move about inside the cell you're editing.

Anyhow, something against 'ON ANY-KEY' events like the following should do the trick...

Code:
ON "ANY-KEY":U OF [I]field name list[/I] IN BROWSE {&BROWSE-NAME} DO:
  /* Turn cursor left into back tab */
  IF KEYFUNCTION ( LASTKEY ) = "CURSOR-LEFT":U THEN DO:
    APPLY "BACK-TAB":U TO SELF.
    RETURN NO-APPLY.
  END.
  /* Turn cursor right into tab */
  ELSE IF KEYFUNCTION ( LASTKEY ) = "CURSOR-RIGHT":U THEN DO:
    APPLY "TAB":U TO SELF.
    RETURN NO-APPLY.
  END.
  /* Turn tab into control+tab to escape browse */
  ELSE IF KEYFUNCTION ( LASTKEY ) = "TAB":U THEN DO:
    APPLY "CTRL-TAB":U TO SELF.
    RETURN NO-APPLY.
  END.
END.

There are a few permutations, you may even like to try doing something with the 'ENABLED-FIELDS-IN-QUERY' pre-processor.

HTH
 
Top