Jump to content
Sign in to follow this  
Drummer1972

Pass working delphi code to c++ builder

Recommended Posts

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 by Drummer1972

Share this post


Link to post

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
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×