Last column full visible

Hi to all,

there's a way to detect if last column is full visible?

I work with 2 grids, the first one for index number and index name, the second for the products.

when use the arrow key to swicth from the first one to the second i use

if Key = VK_RIGHT then

    if SG1.LeftCol=SG1.LastCol then SG2.SetFocus;

It's work fine if the lastrow is partially visible (so when rigth key is pressed the last column is redraw) and leftcol is the lastone.

But if the grid has only 2 columns and the lastcol is full visible, the leftcol is still the first one and the controll does not change.

Tank's in advance


There is not a built-in function that returns this but it can be calculated. 
You can use grid.CellRect() to get the coordinates of a cell in the last column and then see if the grid's cell rectangle + the column width exceeds or does not exceed the total grid width.

Hi Bruno,

thank's for tip.

Have a good week end