Syntacs using CBuilder3

Using CBuilder3, suppose I have a form with a ScrollBox  and TreeView component. I want to place an Image component or a Button component dynamically within the scrollBox for every image in the selected directory of the treeview component much like Imaging programs do. Can a CBuilder3 expert help.
Who is Participating?
Dmitry_Connect With a Mentor Commented:
 TButton *Button = new TButton(ScrollBox1);
  Button->Left = 10;
  Button->Top = 20;
  Button->Caption = "Click me";

Most common mistake made (i think) is that the new component is not given a parent. You can see in the answer you already got from D here that the parent can be set in the instance. Also possible in stead of
new TButton(ScrollBox1) ;

Button->Parent = ScrollBox1;
If you don't give the control / component a name it'll be "floating" (of nulled) and you'll get the weirdest errors!

Good luck !

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.