PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Catching a tab into a grid  (Read 511 times)

Peter.Higgins

  • Gold Member
  • ****
  • Posts: 67
    • View Profile
Catching a tab into a grid
« on: August 16, 2018, 09:41:59 AM »
Believe this has been asked and answered before, but I cannot remember how it is done.  Have a  grid focus event, and need to ignore the initial grid focus event from the tab key and first Tab entry.  _eom$  and grd'eom$ are returning null.  ctl returned is always the control number plus 5000 regardless of using tab, click etc to move to the grid. 

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3359
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: Catching a tab into a grid
« Reply #1 on: August 16, 2018, 10:48:49 AM »
If you have signal all changes (auto mode) then the system will treat each cell as if they were their own control thus if you have On focus events being signaled then you will get a signal when entering any cell regardless of how you got there.  If you don't have Signal all changes then you will only get a on focus event when the grid itself is entered regardless of which cell.

There is no real way to determine if the focus but there is a kludge that might get you want you want. 

In the Onfocus event for the grid check the value in MSE(25,2) which should have the binary value of the last control with focus.  If it is not the Grid's CTL id then you can from an external control however you will need to force a reset of this value by then issuing a SET_FOCUS 0.  Nomads when it finds focus is on 0 (the window itself) will force focus back to the Grid so when you next check MSE(25,2) the last control to lose focus will now be the grid itself.

Something like this:

x=dec(mid(mse,25,2)); if x<>id then set_focus 0 else (change of cell focus event)

As I said -- its a kludge but might provide what you need.