dolphin King
asked on
Tvertscrollbox like a whatsapp layout
i got this code from fmxexpress demo its show text like a whatsapp layout but i got one problem
sadly the new text comes to top of the Tvertscrollbox Ā and the old text comes to down , i want to reverse this , i want to make the new added text comes to down and the old go to top
sadly the new text comes to top of the Tvertscrollbox Ā and the old text comes to down , i want to reverse this , i want to make the new added text comes to down and the old go to top
procedure TForm1.Button1Click(Sender: TObject);
var
CR: TCalloutRectangle;
L: TText;
TmpImg: TImage;
begin
CR := TCalloutRectangle.Create(Self);
CR.Parent := VSB;
CR.Align := TAlignLayout.alTop;
CR.CalloutPosition := TCalloutPosition.cpLeft;
CR.Margins.Top := 10;
CR.Margins.Bottom := 10;
CR.Margins.Right := 5;
CR.Height := 75;
L := TText.Create(Self);
L.Parent := CR;
L.Align := TAlignLayout.alClient;
L.Text := edit1.Text;
L.Margins.Left := 15;
L.Margins.Right := 5;
L.Width := CR.Width-20;
L.WordWrap := True;
L.AutoSize := True;
L.OnPaint := LabelPaint;
TmpImg := TImage.Create(Self);
TmpImg.Parent := CR;
TmpImg.Align := TAlignLayout.alRight;
TmpImg.Bitmap.Assign(Image1.Bitmap);
TmpImg.Width := 75;
VSB.ViewportPosition:=pointf(99999,99999); // go to top
VSB.RealignContent;
end;
ASKER
its only show 1 callout the other is not visible
owners for objects are wrong. should be:
CR := TCalloutRectangle.Create(VSB);
..
L := TText.Create(CR);
..
TmpImg := TImage.Create(CR);
...
ASKER
it does not show at all now current code
procedure TForm1.Button2Click(Sender: TObject);
var
CR: TCalloutRectangle;
L: TText;
TmpImg: TImage;
begin
CR := TCalloutRectangle.Create(VSB);
CR.Parent := VSB;
CR.Align := TAlignLayout.alTop;
CR.Margins.Top := 10000;
CR.CalloutPosition := TCalloutPosition.cpRight;
CR.Margins.Bottom := 10;
CR.Margins.Left := 5;
CR.Height := 75;
L := TText.Create(CR);
L.Parent := CR;
L.Align := TAlignLayout.alClient;
L.Text := 'A quick brown fox jumped over the yellow log running away from the pink dog and ran down the lane.';
L.Margins.Right := 15;
L.Margins.Left := 5;
L.Width := CR.Width-20;
L.WordWrap := True;
L.AutoSize := True;
L.OnPaint := LabelPaint;
TmpImg := TImage.Create(CR);
TmpImg.Parent := CR;
TmpImg.Align := TAlignLayout.alLeft;
TmpImg.Bitmap.Assign(Image1.Bitmap);
TmpImg.Width := 75;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Align to top will push component back to last one before.