Add a TextBox in a RV in the middle of a line
Posted: Tue Sep 06, 2022 2:51 pm
I would like to be able to add a textbox in a Richview in the middle of a line. Currently, when I try, it breaks my line (visually adding a CR ?).
The code I use:
I thought maybe it were an align issue (ClearLeft or ClearRight on my item doesn't help).
Does someone have an idea?
The code I use:
Code: Select all
procedure TForm1.ReplacePlaceHolderItemByATextBox(RVData: TCustomRVData; var ARVE: TRichViewEdit; i: integer {place holder item No});
var
TextBox: TRVTextBoxItemInfo;
id: integer;
begin
TextBox := TRVTextBoxItemInfo.Create(RVData);
TextBox.Document.Clear;
TextBox.Document.AddTextBlockNLA(ListeDesChamps.GetValue(TAG_SignatureCaseACocher),RVData.GetItem(i).StyleNo,RVData.GetItem(i).ParaNo);
// position
TextBox.BoxPosition.HorizontalAnchor := rvhanCharacter;
TextBox.BoxPosition.VerticalAnchor := rvvanLine;
TextBox.BoxPosition.PositionInText := rvpitBelowText;
// size
TextBox.BoxProperties.WidthType := rvbwtAbsolute;
TextBox.BoxProperties.HeightType := rvbhtAbsolute;
TextBox.BoxProperties.Width := 300;
TextBox.BoxProperties.Height := 10;
TextBox.BoxProperties.VAlign := tlBottom;
// removing border and spacing around
TextBox.BoxProperties.Border.Style := rvbNone;//Single;
TextBox.BoxProperties.Border.BorderOffsets.SetAll(0);
TextBox.BoxProperties.Border.Width := 0;
TextBox.BoxProperties.Background.BorderOffsets.SetAll(0);
TextBox.ParaNo := RVData.GetItem(i).ParaNo;
TextBox.BR := False;
TextBox.ClearLeft := False;
TextBox.ClearRight := False;
// adding text box
RVData.AddItem('', TextBox);
id := RVData.Items.IndexOfObject(TextBox);
RVData.Items.Exchange(id , i); // to place my text box at a specific place (instead of my placeholder item)
RVData.DeleteItems(id,1); // I delete my place holder item
ARVE.Format;
end;
Does someone have an idea?