Subject Re: [IBO] Hint when mousemove on grid ?
Author mmusetti70
Ok Andrew, I got it.

Thank you very much.

Marcos

--- In IBObjects@yahoogroups.com, Andrew <ahaines@...> wrote:
>
> On 03/24/2010 04:16 PM, mmusetti70 wrote:
> > How can I show a hint when the mouse passes on a specific cell of a grid (TIB_grid) ?
> >
> >
> I only cared about what row I was on but this may help you get started.
>
> procedure TForm_main.IB_Grid1MouseMove(Sender: TObject; Shift: TShiftState;
> X, Y: Integer);
> var
> gc : TGridCoord;
> mydatarow : Integer;
> mybufrownum : Integer;
> mybufdelta : Integer;
> begin
> // determine what row we are over and modify the hint
> gc := IB_Grid1.MouseCoord(X,Y);
> if (gc.X > 0) and (gc.Y > 0) then
> begin
> // we have the grid row, now find the data row
> mydatarow := IB_Grid1.DataRow[gc.Y];
> // save the current record number
> mybufrownum := IB_Grid1.DataSource.DataSet.BufferRowNum;
> // calculate the difference between the mouse's data row and the
> current data row
> if(mybufrownum < mydatarow) then mybufdelta :=
> mydatarow-mybufrownum else mybufdelta := mybufrownum-mydatarow;
> // move the current row to the mouse's row
> IB_Grid1.DataSource.DataSet.BufferMoveBy(mybufdelta);
>
> IB_Grid1.Hint := 'Y:' + IntToStr(gc.Y) + ' DataRow:' +
> IntToStr(mydatarow) + ' Invoice:' +
> IB_Grid1.DataSource.Dataset.BufferFieldByName('invoice').AsString;
> // reset the current record number
> IB_Grid1.DataSource.DataSet.BufferRowNum := mybufrownum;
> end;
> end;
>
>
>
>
> [Non-text portions of this message have been removed]
>