Set Focus to Cell in Grid

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
lawingo
Posts: 43
Joined: Fri Dec 04, 2015 6:41 am

Set Focus to Cell in Grid

Post by lawingo » Tue Feb 12, 2019 3:18 am

Hopefully an easy Question:

I want to select the 1st Record in a grid and set focus to a cell in the 1st Row. In my example, the cell I want to set focus to is "GridColumn6". The code below selects the 1st record and it visually sets focus to the cell I want but I still have to click in the Cell in order to change it's value. I would like to have the value of the cell automatically selected. Thanks for your Help!

Code: Select all

* Select 1st Record
Selectlist Named(#GridMain)
Set Com(#GridMain.CurrentItem) Selected(True) Focus(True) Ensurevisible(True)
Leave
Endselect

Set Com(#GridColumn6.Cell<1>.Column) Focus(True) Selected(True) Ensurevisible(True)


René Houba
Posts: 48
Joined: Thu Nov 26, 2015 7:03 am

Re: Set Focus to Cell in Grid

Post by René Houba » Wed Feb 13, 2019 9:54 am

Hi Lawingo,

After:
Set Com(#GridColumn6.Cell<1>.Column) Focus(True) Selected(True) Ensurevisible(True)

Do:
GridMain.SetFocus

Does that help?

Kind regards,
René

User avatar
lawingo
Posts: 43
Joined: Fri Dec 04, 2015 6:41 am

Re: Set Focus to Cell in Grid

Post by lawingo » Thu Feb 14, 2019 4:35 am

Bingo!

Thanks for your help.

Post Reply