Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting a Frame on a Form

Status
Not open for further replies.

tjcusick

Programmer
Dec 26, 2006
134
US
Using Delphi 7.

We created a Date Picker Frame so that we could just drop it onto our forms. The problem that is happening is that once the Date Picker Frame is placed correctly and then the form is saved, you can no longer open the Form in design mode.

We get a Message:
Error Reading Form
List index out of bounds(2). Ignore the error and continue?

Ignoring the error and we get:
Error
Error creating form: Access violation at address 4002EBE8 in module 'rtl70.bpl'. Read of address 0000000C.

Suggestions?

Thanks for the help in advance.

Tom Cusick
 
>We created a Date Picker Frame

You mean you created a component, a custom control?

Sounds like it's buggy. Post code.
 
Well since it really is a frame, there are some requirements to getting frames to behave on a form. I use frames quite a bit and always load them at run-time.

My frames are in separate units like yours and are defined in the public section of my main form.
Code:
type
  TMainForm = class(TForm)
    ActionList1: TActionList;    //actions:
    ..
    PageControl: TPageControl;   //tabs:
    TabSheetDept: TTabSheet;
    TabSheetPrGrp: TTabSheet;
    ..
   public
    { Public declarations }
    DeptFrame: TDeptFrame;       //frames:
    PrGrpFrame: TPrGrpFrame;
    ..

My primary frames are created in the OnCreate() of my main form, which loads the frames into TTabSheet(s) of a TPageControl.
Code:
  DeptFrame:= TDeptFrame.Create(Self);
  DeptFrame.Parent:= TabSheetDept;
  DeptFrame.Align:= alClient;

  PrGrpFrame:= TPrGrpFrame.Create(Self);
  PrGrpFrame.Parent:= TabSheetPrGrp;
  PrGrpFrame.Align:= alClient;
And of course Freed in my OnDestroy. This particular app has over a dozen frames. The rest are created and loaded only when the parent tab is selected, then freed when another tab is selected.

Although you posted your frame unit code, you haven't shown how it is called. I suspect that may be where your problem is. You may simply have to define the frame's parent and alignment as shown.


Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top