trichview.com

trichview.support




Re: FillFields with overwrite


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/28/2005 17:44:25


As for modifying FillFields procedure, it's up to you.

It's simple - you can get the existing text using GetItemTextA, modify it

and put back by SetItemTextA.


The overwrite mode is not supported directly. But you can implement it using

events.

The code is below.


var IgnoreNextChar: Boolean = False;


procedure TForm1.RichViewEdit1KeyDown(Sender: TObject; var Key: Word;

  Shift: TShiftState);

begin

  IgnoreNextChar := RichViewEdit1.SelectionExists;

end;


procedure TForm1.RichViewEdit1KeyPress(Sender: TObject; var Key: Char);

var rve: TCustomRichViewEdit;

    ItemNo, Offs: Integer;

begin

  if IgnoreNextChar then begin

    IgnoreNextChar := False;

    exit;

  end;

  IgnoreNextChar := False;

  if not ((Key=#9) or (Key>=' ')) then

    exit;

  rve := RichViewEdit1;

  while rve.InplaceEditor<>nil do

    rve := TCustomRichViewEdit(rve.InplaceEditor);

  if rve.SelectionExists then

    exit;

  ItemNo := rve.CurItemNo;

  Offs  := rve.OffsetInCurItem;

  if (Offs>=rve.GetOffsAfterItem(ItemNo)) then begin

    if (ItemNo+1<rve.ItemCount) and

       not rve.IsFromNewLine(ItemNo+1) then begin

      inc(ItemNo);

      Offs := rve.GetOffsBeforeItem(ItemNo);

      end

    else

      exit;

  end;

  rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs+1);

  rve.Invalidate;

end;



>

> Hi

> I'm using DBRichViewEdit.

> When I to use Fillfields to replace for values, I need that the value is

> inserted as if the keyboard key Insert is pressed(overwrite).

> Example:

> ____________________________________

> Name: <%Customer_Name%>.............

> Date: <%Date%>......................

> ____________________________________

> if I to use fillfields it will go to play the dotted ones for front, I

needs

> that it goes substituting the dotted ones

> ____________________________________

> Name: George John Washington.............

> Date: 04/26/2005......................

> ____________________________________

>

>

> it needs to be thus:

> ____________________________________

> Name: George John Washington........

> Date: 04/26/2005....................

> ____________________________________

>

> can help me ?

>

> thanks

>





Powered by ABC Amber Outlook Express Converter