Subject Re: [IBO] Grids & Hints
Author Sean Preston
Hi

Thanks. This looks interesting. It gives me some ideas to play around
with.

Cheers
Sean

nibler@... wrote:

> Hi Sean,
>
> the code below is for showing a hint, when the contents
> of the grid is longer then the grid´s cell. However, this
> code could give you some ideas and you may alter it for your needs.
>
> Harald
>
> //
> **********************************************************************
> ***** unit IB_HintGrid;
>
> interface
>
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
> Dialogs, Grids, IB_Grid;
>
> type
> TIB_HintGrid = class(TIB_Grid)
> private
> { Private-Deklarationen }
> protected
> { Protected-Deklarationen }
> FOldCoOrd :TGridCoOrd;
> public
> { Public-Deklarationen }
> constructor Create(Aowner: Tcomponent); override;
> procedure GrdMouseMove(Sender: TObject;Shift: TShiftState; X, Y:
> Integer);
>
> published
> { Published-Deklarationen }
> end;
>
>
>
> procedure Register;
>
>
> implementation
>
>
> { TIB_HintGrid }
>
>
> procedure TIB_HintGrid.GrdMouseMove(Sender: TObject;
> Shift: TShiftState; X, Y: Integer);
> var
> CoOrd : TGridCoOrd;
> TxtWidth,
> FldWidth : integer;
> MouseInGrid : boolean;
> Offset : byte;
> tmp : string;
>
>
> begin
> with (Sender As TIB_HintGrid) do begin
> if (DataSource = nil) or (not DataSource.Prepared) then exit;
> CoOrd := MouseCoord(X,Y);
> if (FOldCoOrd.X = CoOrd.X) and (FOldCoOrd.Y = CoOrd.Y) then exit;
> FOldCoOrd.X := CoOrd.X;
> FOldCoOrd.Y := CoOrd.Y;
> if IndicateRow then Offset := 1 else Offset := 0;
> MouseInGrid := (CoOrd.X >= Offset) and (CoOrd.Y >=0);
> if MouseInGrid then begin
> tmp := GetCellDisplayText(CoOrd.X,CoOrd.Y);
> TxtWidth := Canvas.TextWidth(tmp)+ 4;
> if pos(#10,tmp) > 0 then FldWidth := 0
> else FldWidth := GridFields[CoOrd.x-Offset].DisplayWidth;
> if FldWidth < TxtWidth then begin
> Hint := tmp;
> Application.ActivateHint(Mouse.CursorPos)
> end
> else begin
> Hint := '';
> Application.CancelHint
> end;
> end;
> end;
> end; {grdMouseMove}
>
> constructor TIB_HintGrid.Create(Aowner: Tcomponent);
> begin
> inherited create(AOwner);
> OnMouseMove := GrdMouseMove;
> FOldCoOrd.X := -1;
> FOldCoOrd.Y := -1;
> end;
>
>
> procedure Register;
> begin
> RegisterComponents('iboGrids', [TIB_HintGrid]);
> end;
>
>
> end.
>
> //*****************************************************************
>
> Sean Preston schrieb:
> >
> > Hi
> >
> > I have been looking for some help on this and keep coming up with
> > blanks. I want to be able to show different hints as a user moves
> > the mouse around a grid. So for instance if the were 3 rows with 3
> > columns each then there could potentially be 9 different hints, one
> > for each cell. I want to be able to update the hint information
> > without having to first click on the cell.
> >
> > Any ideas how I can do this with an IBO Grid?
> >
> > Thanks
> > Sean
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> >
> > ____________________________________________________________________
> > _______ IB Objects - direct, complete, custom connectivity to
> > Firebird or InterBase without the need for BDE, ODBC
> > or any other layer.
> > ____________________________________________________________________
> > _______ http://www.ibobjects.com - your IBO community resource for
> > Tech Info papers, keyword-searchable FAQ, community code
> > contributions and more !
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Get 128 Bit SSL Encryption!
> http://us.click.yahoo.com/FpY02D/vN2EAA/xGHJAA/PhFolB/TM
> ---------------------------------------------------------------------~
> ->
>
> ______________________________________________________________________
> _____ IB Objects - direct, complete, custom connectivity to Firebird
> or InterBase without the need for BDE, ODBC or any other
> layer.
> ______________________________________________________________________
> _____ http://www.ibobjects.com - your IBO community resource for Tech
> Info papers, keyword-searchable FAQ, community code contributions and
> more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo
> com/info/terms/