Drummer1972 0 Posted April 2, 2023 (edited) Hello I work with C++ and I need to use this code written in Delphi (it works): Var A:Integer; Var LastPanel : Double; Begin For A:=0 to HorzScrollBox1.Content.ChildrenCount-1 do TGridLayout (HorzScrollBox1.Content.Children[A].widht:= HorzScrollBox1.width; HorzScrollBox1.ViewportPosition:=TPointF.Create(LastPanel * HorzScrollBox1.width,0 ); End; I have implemented only : for (int a=0; a<=HorzScrollBox1->Content->ChildrenCount-1;a++) { TGridLayout(HorzScrollBox1->Content->Children[a])->Width = HorzScrollBox1->Width} HorzscrollBox1->ViewportPosition= On the line : "TGridLayout(HorzScrollBox1->Content->…” it gives me the error : matching conversion for functional-style cast from 'Fmx::Types::TFmxChildrenList' to 'Fmx::Layouts::TGridLayout'" lso I think that TPointF is a type included in SystemTypes.h. It's possible?. THANKS Edited April 2, 2023 by Drummer1972 Share this post Link to post
Roger Cigol 103 Posted April 2, 2023 What C++ compiler are you using? Can you post the contents of form file (*.dfm) that corresponds to the two components TGridLayout and HorzScrollBox1. (or create a complete form that is a minimum not-working example) and paste the entire *.dfm file). Share this post Link to post
Drummer1972 0 Posted April 2, 2023 48 minutes ago, Drummer1972 said: Var A:Integer; Var LastPanel : Double; Begin For A=0 to HorzscrollBox1.content.childrenCount-1 To TGridLayout (HorzscrollBox1.content.children[A].widht:= HorzscrollBox1.width; HorzscrollBox1.ViewportPosition:=TPointF.Create(LastPanel * HorzscrollBox1.width,0 ); End Thank you very much for answering.. I use rad studio 11. Volvo has given me the solution and it is the following: for ( int A = 0 ; A < HorzScrollBox1 - > Content - > ChildrenCount ; A ++ ) { static_cast < TGridLayout * > ( HorzScrollBox1 - > Content - > Children - > Items [ A ] ) - > Width = HorzScrollBox1 - > Width ; } dobleÚltimoPanel = 1.0 ; // <--- solo un ejemplo, ponga su valor aquí HorzScrollBox1 - > ViewportPosition = PointF ( LastPanel * HorzScrollBox1 - > Width, 0.0 ) ; Share this post Link to post
David Heffernan 2345 Posted April 2, 2023 FWIW the Delphi code doesn't compile. Always paste code that is known to work, rather than copy it out manually. Share this post Link to post