unit ucotacao;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, Grids, DBGrids, ToolWin, ComCtrls, StdCtrls, ExtCtrls;

type

THackDBGrid = class(TDBGrid);

  Tfcotacao = class(TForm)
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    Panel1: TPanel;
    Label1: TLabel;
    Label2: TLabel;
    StatusBar1: TStatusBar;
    Panel5: TPanel;
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
  procedure AppHint(Sender : TObject); 


    { Private declarations }
  public
    { Public declarations }
  end;

var
  fcotacao: Tfcotacao;

implementation

uses UnitMenu, udm;

procedure Tfcotacao.AppHint(Sender: TObject);
begin
  StatusBar1.Panels[0].Text := Application.Hint;
end;

{$R *.DFM}

procedure Tfcotacao.FormActivate(Sender: TObject);
begin
   THackDBGrid(DBGrid1).FixedCols := 6;
   (fdm.query1.fieldbyname ('valor') as tfloatfield).displayformat := '###,##0.00';
   (fdm.query1.fieldbyname ('código') as tfloatfield).displayformat := '000000';   
end;

procedure Tfcotacao.FormClose(Sender: TObject; var Action: TCloseAction);
begin
       Application.OnHint := nil;

        fdm.query1.close;
end;

procedure Tfcotacao.FormCreate(Sender: TObject);
begin
       Application.OnHint := AppHint;
end;

procedure Tfcotacao.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
  Comp: Trichedit; // * variável Comp da classe TMemo
  texto : string;
begin

  if key = vk_f1 then begin

  Comp := Trichedit.Create (Self);  // * cria o componente Memo
  Comp.Parent := Self;    // * exibe o componente criado

  if fileexists (extractfilepath(paramstr(0)) + '\ajuda\ajudacotacao.txt') then
   comp.lines.loadfromfile (extractfilepath(paramstr(0)) + '\ajuda\ajudacotacao.txt');

  texto := comp.Text;
  comp.Destroy;

  Showmessage (texto);

  end;

end;

end.
