Reg. Data displaying like webpage using firemonkey

  

I’m using delphi 10.1 Berlin for developing mobile application for Android and iOs application. And I have requirement to implement the data like webpage (means the first few words should display in normal and next word should be underline word and the next few words should be bold and also some words should redirect to some webpage and also need to increase and decrease the size of the font and also with the background image ). And in VCL delphi application, it has TRichEdit component.
And in firemonkey, I have tried to implement using the labels but in that I faced the issue which is mentioned below:
If I need to display in the same line contains the normal word and the word which is underline, then I cant able to display to near that normal font word.
How can I able to implement in Firemonkey for Mobile app. And I found some TMS component and I don’t know how to use this.
And below I have shown the sample code that I have implemented:
I have written the CreateLabel method to display the values in the TVertScrollBox. iLastLeftValue and iLastTopValue are the global values.

Procedure CreateLabel(strContent: String; bIsBold, bIsItalic,bNewPara, bTitleFont, bUnderLine, bUseLastLeftVal: Boolean)
begin
LabelContentDisp := TLabel.Create(nil);
LabelContentDisp.Name := ‘Value’;
LabelContentDisp.Parent := VertScrollBox1;
LabelContentDisp.FontColor := $FFDCC8B8;
LabelContentDisp.Font.Family := ‘DroidSans’;
//Reading the value from Settings as the user can set the size
if bTitleFont then
LabelContentDisp.Font.Size := LanguageLoader.ContentFontSize – 6
else
LabelContentDisp.Font.Size := LanguageLoader.ContentFontSize;
if bNewPara then
strContent := ‘ ‘ + strContent;
LabelContentDisp.StyledSettings := LabelContentDisp.StyledSettings –
[TStyledSetting.Family, TStyledSetting.Size, TStyledSetting.FontColor, TStyledSetting.Style, TStyledSetting.Other];
if bIsBold then
begin
LabelContentDisp.Font.Family := ‘Cambria’;
LabelContentDisp.TextSettings.Font.Style := LabelContentDisp.TextSettings.Font.Style + [TfontStyle.fsBold];
end;
if bIsItalic then
begin
LabelContentDisp.Font.Family := ‘Cambria’;
LabelContentDisp.TextSettings.Font.Style := LabelContentDisp.TextSettings.Font.Style + [TfontStyle.fsItalic];
end;
if bUnderLine then
begin
LabelContentDisp.Font.Family := ‘Cambria’;
LabelContentDisp.TextSettings.Font.Style := LabelContentDisp.TextSettings.Font.Style + [TfontStyle.fsUnderline];
LabelContentDisp.HitTest := True;
LabelContentDisp.Name := ‘Label’ + IntToStr(iLinksValue);
LabelContentDisp.OnClick := LabelClick;
Inc(iLinksValue);
end;
LabelContentDisp.AutoSize := True;
if bUseLastLeftVal then
begin
LabelContentDisp.Position.X := iLastLeftValue + 2;
LabelContentDisp.Position.Y := iLastTopValue;
end
else
begin
LabelContentDisp.Position.Y := iLabelPosition + 2;
iLabelPosition := iLabelPosition + Round(LabelContentDisp.Height) + 25;
end;
LabelContentDisp.Text := strContent;
LabelContentDisp.TextSettings.WordWrap := True;
LabelContentDisp.Align := TAlignLayout.Top;
iLastLeftValue := Round(LabelContentDisp.Position.X) + Round(LabelContentDisp.Width) + 2;
iLastTopValue := Round(LabelContentDisp.Position.Y);
LabelContentList.Add(LabelContentDisp);
end;

And if I’m implementing the TwebPage how can I able to proceed with the size and also with the background image. Please help me to implement this webpage like functionality. Thanks in advance.

Comments are closed.