September 18th, 2012, 12:20 PM
Problems adding a frame to a TScrollBox dynamically
I'm dynamically adding frames to scroll box that has existing frames. They are laid out as rows. I'm having two problems with this.
1) I add the new frame, it shows up and looks good. If I scroll or resize the form, the new frame moves down and leaves a gap between it and the rest of the frames. The gap is about the same size as the frame added.
2) I exit and and crash in the destructor of the new frame. My added frame doesn't have a defined destructor.
Here's some pseudocode.
MyFrame newFrame = new MyFrame(ScrollBoxControl);
newFrame->Parent = ScrollBoxControl;
newFrame->Align = alTop;
newFrame->Left = 0;
newFrame->Top = LastFrame->Top + LastFrame->Height;
newFrame->Height = 83; // always 83
newFrame->Width = 830; // always 830
newFrame->Visible = true;
Any ideas on what I'm doing wrong?