#1 2015-03-11 06:19:09

noobies
Member
Registered: 2011-09-13
Posts: 139

show hint text in drawgrid in current language

very simple replace text in header drawgirid use function

  fieldText: array [0..10] of string = (
    '№',
    '№ БЛ',
    'Выдан',
    'Фамилия',
    'Имя',
    'Отчество',
    'Д/р',
    'Место работы',
    'пред БЛ',
    'след БЛ',
    '#');
...

SQLTableToGrid.OnValueText := OnListText;
...
function TfrmMain.OnListText(Sender: TSQLTable; FieldIndex, RowIndex: Integer; var Text: string): boolean;
begin
  if RowIndex = 0 then begin
    Text := fieldText[FieldIndex];
    Result := True;
  end
  else
    Result := False;
end;

but how change hint (sample right click on header), i dont find this function, and no option to disable

Offline

#2 2015-03-11 06:41:16

noobies
Member
Registered: 2011-09-13
Posts: 139

Re: show hint text in drawgrid in current language

i change in source from

procedure TSQLTableToGrid.DrawGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
...
  if ARow=0 then
  if (ssCtrl in Shift) or (Button<>mbLeft) then begin
    // Ctrl or right button pressed -> display first row as hint
    ShowHintString(U2S(Table.Get(ARow,ACol)),ACol,ARow,4000);

to

  SQLTableToGrid.OnHintText := OnListText;


procedure TSQLTableToGrid.DrawGridMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
...
  if ARow=0 then
  if (ssCtrl in Shift) or (Button<>mbLeft) then begin
    // Ctrl or right button pressed -> display first row as hint
    if Assigned(OnHintText) and OnHintText(Table,ACol,ARow,Hint) then
      ShowHintString(Hint,ACol,ARow,4000)
    else
      ShowHintString(U2S(Table.Get(ARow,ACol)),ACol,ARow,4000);

its work and view russian name column, but first i see english column name before draw russian column name. How draw text without this bug?

Last edited by noobies (2015-03-11 06:42:15)

Offline

Board footer

Powered by FluxBB